/* OneCloud Networks CRM — Stylesheet */
:root {
    --primary: #0a3d62;
    --accent: #2e86c1;
    --success: #17a589;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --border: #dee2e6;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --sidebar-width: 240px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--light);
    color: var(--dark);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
    color: #fff;
}

.logo-top {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-top .cl { color: var(--accent); }

.logo-top .ai-badge {
    background: var(--success);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
    font-weight: 600;
}

.networks-sub {
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.7;
    margin-top: -2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-right: 3px solid var(--accent);
}

.nav-icon { margin-right: 10px; font-size: 16px; }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 20px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info { }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; opacity: 0.6; }

.logout-btn {
    background: rgba(255,255,255,0.1);
    color: #fff;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-decoration: none !important;
    transition: background 0.2s;
}
.logout-btn:hover { background: rgba(255,255,255,0.2); }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s;
    line-height: 1.4;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2474a8; color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #138d75; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }

.btn-secondary { background: var(--gray-light); color: var(--dark); }
.btn-secondary:hover { background: #d5d8dc; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-content {}
.stat-value { font-size: 24px; font-weight: 700; color: var(--dark); }
.stat-label { font-size: 12px; color: var(--gray); font-weight: 500; }

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-light);
    font-size: 13px;
}

table tbody tr:hover { background: #f8f9fa; }

table td a { font-weight: 500; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--dark);
    transition: border-color 0.2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.15);
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filters-bar .form-control {
    width: auto;
    min-width: 160px;
}

.filters-bar .search-input {
    flex: 1;
    min-width: 200px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 20px;
    justify-content: center;
}

.pagination a {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--dark);
    text-decoration: none !important;
}

.pagination a:hover { background: var(--gray-light); }
.pagination a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Badge */
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* Activity Timeline */
.timeline {
    position: relative;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
}

.timeline-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.timeline-content { flex: 1; }
.timeline-header { font-weight: 500; font-size: 13px; }
.timeline-desc { font-size: 12px; color: var(--gray); margin-top: 2px; }
.timeline-time { font-size: 11px; color: var(--gray); margin-top: 4px; }

/* Pipeline / Kanban */
.pipeline-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.pipeline-column {
    min-width: 260px;
    max-width: 300px;
    flex-shrink: 0;
    background: var(--light);
    border-radius: var(--radius);
    padding: 12px;
}

.pipeline-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
}

.pipeline-column-count {
    background: var(--gray-light);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--gray);
}

.pipeline-card {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.pipeline-card:hover { box-shadow: var(--shadow-lg); }
.pipeline-card-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.pipeline-card-company { font-size: 12px; color: var(--gray); }
.pipeline-card-value { font-size: 14px; font-weight: 600; color: var(--success); margin-top: 8px; }

/* Detail Page */
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.detail-title {
    font-size: 22px;
    font-weight: 700;
}

.detail-subtitle {
    font-size: 14px;
    color: var(--gray);
    margin-top: 2px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-field {}
.detail-field-label { font-size: 11px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.detail-field-value { font-size: 14px; margin-top: 2px; }

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-decoration: none !important;
}

.tab:hover { color: var(--dark); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
    padding: 0;
    line-height: 1;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #1a5276 100%);
}

.login-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo .logo-top {
    font-size: 28px;
    color: var(--primary);
}

.login-logo .networks-sub {
    color: var(--gray);
}

.login-title {
    text-align: center;
    font-size: 16px;
    color: var(--gray);
    margin-bottom: 24px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; margin-bottom: 16px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .pipeline-board { flex-direction: column; }
    .pipeline-column { min-width: 100%; max-width: 100%; }
}
