/* CS Performance Dashboard - Copper & Slate Palette */
:root {
    /* Primary Colors */
    --primary-dark: #2F3640;
    --primary: #4A5568;
    --primary-light: #8FA3B0;
    --accent: #B87333;
    --accent-light: #D4A574;
    
    /* Background Colors */
    --bg-primary: #F5F0EB;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E8E2DC;
    
    /* Text Colors */
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --text-light: #A0AEC0;
    
    /* Status Colors */
    --success: #38A169;
    --success-light: #C6F6D5;
    --warning: #D69E2E;
    --warning-light: #FEFCBF;
    --danger: #E53E3E;
    --danger-light: #FED7D7;
    --info: #3182CE;
    --info-light: #BEE3F8;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: var(--shadow-md);
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.nav-menu {
    flex: 1;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-base);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-dark);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

.nav-item svg {
    flex-shrink: 0;
}

.badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--bg-tertiary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: var(--space-2xl);
    max-width: calc(100% - 260px);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2xl);
}

.header-left h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.header-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.header-right {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    border: none;
    font-family: var(--font-body);
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: #A0602A;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--bg-tertiary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-text {
    background: transparent;
    color: var(--accent);
    padding: var(--space-sm) var(--space-md);
}

.btn-text:hover {
    background: rgba(184, 115, 51, 0.1);
}

/* KPI Section */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.kpi-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid transparent;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-light);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.kpi-trend.positive {
    color: var(--success);
    background: var(--success-light);
}

.kpi-trend.negative {
    color: var(--danger);
    background: var(--danger-light);
}

.kpi-value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.kpi-unit {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 4px;
}

.kpi-chart {
    height: 40px;
}

.sparkline {
    width: 100%;
    height: 100%;
    color: var(--accent);
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.chart-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
}

.chart-card.large {
    min-height: 400px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.chart-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-legend {
    display: flex;
    gap: var(--space-lg);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.received {
    background: var(--accent);
}

.legend-dot.resolved {
    background: var(--success);
}

.chart-container {
    position: relative;
    height: calc(100% - 60px);
    min-height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Bottom Section */
.bottom-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-lg);
}

.table-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.table-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: var(--space-md);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--bg-tertiary);
}

.data-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--bg-tertiary);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: var(--bg-primary);
}

.agent-cell {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.agent-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.agent-info {
    display: flex;
    flex-direction: column;
}

.agent-name {
    font-weight: 600;
    color: var(--text-primary);
}

.agent-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.rating {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.rating-value {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 28px;
}

.rating-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.rating-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: 3px;
    transition: width var(--transition-slow);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.online {
    color: var(--success);
    background: var(--success-light);
}

.status-badge.online::before {
    background: var(--success);
}

.status-badge.away {
    color: var(--warning);
    background: var(--warning-light);
}

.status-badge.away::before {
    background: var(--warning);
}

/* Activity Card */
.activity-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.activity-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.activity-item {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.activity-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.activity-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 4px;
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card {
    animation: fadeIn 0.6s ease forwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }

.chart-card {
    animation: fadeIn 0.6s ease forwards;
    animation-delay: 0.5s;
}

.table-card, .activity-card {
    animation: fadeIn 0.6s ease forwards;
    animation-delay: 0.6s;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .chart-card.large {
        min-height: 350px;
    }
    
    .bottom-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .logo-text, .nav-item span, .user-info {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: var(--space-md);
    }
    
    .badge {
        position: absolute;
        top: 8px;
        right: 8px;
        margin: 0;
    }
    
    .main-content {
        margin-left: 80px;
        max-width: calc(100% - 80px);
    }
    
    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: var(--space-lg);
    }
    
    .header {
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    .header-right {
        width: 100%;
        justify-content: flex-start;
    }
    
    .kpi-section {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: var(--space-sm);
    }
    
    .agent-role {
        display: none;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}