/* Dashboard Premium Complete Redesign - Full Width Topbar Layout */

/* Page Premium Structure */
.page-premium {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Full Width Topbar (Above Everything) */
.dashboard-header-dark-fullwidth {
    background: rgba(30, 41, 59, 0.85) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Content Wrapper (Below Topbar) */
.content-wrapper-premium {
    display: flex;
    margin-top: 64px;
    /* Height of topbar */
    min-height: calc(100vh - 64px);
}

/* Full Width Dashboard Support (Overrides global max-width) */
.page-premium .content-wrapper-premium .main-content-premium .content,
.main-content-premium article.content,
.dashboard-modern-container,
.dashboard-full-width-wrapper {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

/* Ensure children also don't center */
.dashboard-modern-container>* {
    max-width: none !important;
}

/* Sidebar (Fixed Position, Below Topbar) */
.content-wrapper-premium .sidebar {
    position: fixed;
    top: 64px;
    /* Below topbar */
    left: 0;
    width: 270px;
    /* Default width */
    height: calc(100vh - 64px);
    overflow-y: auto;
    transition: width 0.3s ease;
    z-index: 99;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 80px !important;
}

.sidebar.sidebar-minimized {
    width: 80px !important;
}



.sidebar.collapsed .nav-link-modern span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item form button span,
.sidebar.sidebar-minimized .nav-link-modern span,
.sidebar.sidebar-minimized .nav-label,
.sidebar.sidebar-minimized .nav-item form button span {
    display: none !important;
}

.sidebar.collapsed .nav-link-modern,
.sidebar.collapsed .nav-item form button,
.sidebar.sidebar-minimized .nav-link-modern,
.sidebar.sidebar-minimized .nav-item form button {
    justify-content: center !important;
    padding: 0 !important;
    width: 50px !important;
    /*height: 50px !important;*/
    margin: 0 auto 0.5rem auto !important;
    border-radius: 12px !important;
    overflow: visible !important;
}

.sidebar.collapsed .nav-link-modern i,
.sidebar.collapsed .nav-item form button i,
.sidebar.sidebar-minimized .nav-link-modern i,
.sidebar.sidebar-minimized .nav-item form button i {
    font-size: 1.6rem;
    margin: 0;
    color: var(--primary) !important;
    opacity: 1;
}

/* Main Content (Next to Sidebar) */
.main-content-premium {
    flex: 1;
    padding: 1rem !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-right: 0 !important;
    background-color: var(--bg-main);
    min-height: calc(100vh - 64px);
    transition: margin-left 0.3s ease, background-color 0.3s ease;
}

@media (max-width: 991px) {

    .content-wrapper-premium .main-content-premium,
    .content-wrapper-premium .sidebar~.main-content-premium {
        margin-left: 0 !important;
    }
}

/* Expanded Main Content (when sidebar is collapsed) */
@media (min-width: 992px) {

    /* Default Margin (matched with sidebar width) */
    .content-wrapper-premium .sidebar~.main-content-premium {
        /*margin-left: 270px;*/
    }

    .main-content-premium.expanded,
    .content-wrapper-premium .sidebar.collapsed~.main-content-premium,
    .content-wrapper-premium .sidebar.sidebar-minimized~.main-content-premium {
        /*margin-left: 80px !important;*/
        /* Adjusted for collapsed sidebar */
    }
}

/* Dashboard Premium Complete Redesign - Capsule Navigation */

/* Sidebar - Uses skin variables for theming */
.sidebar {
    background-color: var(--bg-sidebar) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15) !important;
    border-right: 1px solid var(--sidebar-border-right, rgba(255, 255, 255, 0.08)) !important;
    transition: background-color 0.3s ease, border-color 0.3s ease !important;
}

/* Navigation Link - Default State */
.nav-link-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem 0.55rem 0.75rem !important;
    color: var(--sidebar-text, #64748b) !important;
    border-radius: 12px !important;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0.125rem 0.5rem !important;
    position: relative;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link-modern i {
    font-size: 1.25rem;
    color: var(--primary, #8b5cf6) !important;
    transition: color 0.2s ease;
    opacity: 0.9;
}

/* Navigation Link - Hover State */
.nav-link-modern:hover {
    background-color: var(--sidebar-hover, rgba(255, 255, 255, 0.06)) !important;
    color: var(--text-main, #f8fafc) !important;
}

.nav-link-modern:hover i {
    color: var(--primary, #8b5cf6) !important;
    opacity: 1;
}

/* Navigation Link - Active State */
.nav-link-modern.active {
    background-color: var(--sidebar-active, rgba(91, 124, 250, 0.15)) !important;
    color: var(--sidebar-active-text, #f8fafc) !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    border-left: none !important;
    box-shadow: none !important;
}

.nav-link-modern.active i {
    color: var(--sidebar-active-text, #f8fafc) !important;
    opacity: 1;
}

/* Section label in nav */
.nav-section__label {
    color: var(--sidebar-text, #64748b);
    opacity: 0.6;
}

/* Dark Header - Keep as is */
.dashboard-header-dark {
    background: #2d3748 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    border-bottom: none !important;
    backdrop-filter: none !important;
}

.dashboard-header-dark * {
    color: white !important;
}

.dashboard-header-dark .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

.dashboard-header-dark .text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Remove Login Button (will be removed from layout) */
.btn-header-login {
    display: none !important;
}

/* Hero Banner — removed (dead CSS) */

/* Stats Grid - 4 Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

/* Stat Icon Colors */
.stat-icon-red {
    background: #fee2e2;
    color: #ef4444;
}

.stat-icon-green {
    background: #d1fae5;
    color: #10b981;
}

.stat-icon-cyan {
    background: #cffafe;
    color: #06b6d4;
}

.stat-icon-blue {
    background: #e0e7ff;
    color: #3b82f6;
}

.stat-icon-orange {
    background: #fed7aa;
    color: #f97316;
}

.stat-icon-purple {
    background: #ede9fe;
    color: #8b5cf6;
}

.stat-label {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-value {
    font-size: 2.75rem;
    /* Increased from 2.5rem - numbers are kings */
    font-weight: 700;
    color: #6d28d9;
    /* Violet sombre */
    line-height: 1;
}

.stat-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

/* Modern Card */
.modern-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.modern-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* Dashboard Premium Container */
.dashboard-premium-container {
    padding: 2rem;
    background: #f1f5f9;
    min-height: calc(100vh - 64px);
}

/* Profile Zone - Clean */
.profile-zone-clean {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.profile-avatar-clean {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #8b5cf6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== NEW MODERN DASHBOARD STYLES ===== */

/* Modern Dashboard Container */
.dashboard-modern-container {
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: calc(100vh - 64px);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 5rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 1rem;
    /* Reduced from 2rem */
}

.dashboard-title {
    font-size: 1.5rem;
    /* Reduced from 2rem */
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.dashboard-subtitle {
    font-size: 0.9rem;
    /* Reduced from 1rem */
    color: #64748b;
}

/* Stats Row - 4 Cards per row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    /* Reduced from 1.5rem */
}

@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

/* Modern Stat Card - Super Compact */
.stat-card-modern {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    gap: 0.75rem;
    align-items: center;
    min-width: 0;
    animation: statCardIn 0.4s ease-out both;
}

.stat-card-modern:nth-child(1) { animation-delay: 0ms; }
.stat-card-modern:nth-child(2) { animation-delay: 80ms; }
.stat-card-modern:nth-child(3) { animation-delay: 160ms; }
.stat-card-modern:nth-child(4) { animation-delay: 240ms; }

@keyframes statCardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stat-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.stat-card-icon {
    width: 40px;
    /* Reduced from 56px */
    height: 40px;
    /* Reduced from 56px */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card-label {
    font-size: 0.7rem;
    /* Reduced from 0.75rem */
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
    margin-bottom: 0;
    white-space: normal;
    /* Allow wrapping to prevent overflow */
}

.stat-card-value {
    font-size: 1.5rem;
    /* Reduced from 2rem */
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0;
    color: #1e293b;
}

.stat-card-trend {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: -2px;
}

/* Stat Card Color Variants */
.stat-card-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.stat-card-red .stat-card-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.stat-card-red .stat-card-value {
    color: #ef4444;
}

.stat-card-green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.stat-card-green .stat-card-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.stat-card-green .stat-card-value {
    color: #10b981;
}

.stat-card-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.stat-card-cyan .stat-card-icon {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.stat-card-cyan .stat-card-value {
    color: #06b6d4;
}

.stat-card-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.stat-card-purple .stat-card-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.stat-card-purple .stat-card-value {
    color: #8b5cf6;
}

/* Side-by-Side Top Section - Grid Optimized for Sidebar */
/* Top Section - Simple Stack */
.dashboard-top-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100% !important;
}

.stats-side {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100% !important;
    min-width: 0;
}

/* Full Width Bottom Votes Section */
.votes-section-bottom {
    width: 100%;
}

.votes-section-bottom .ratings-card {
    width: 100%;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.votes-section-bottom .ratings-card-body {
    flex: 1;
    overflow-x: auto;
}

.votes-side .ratings-card {
    width: 100%;
    height: 100%;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.votes-side .ratings-card-body {
    flex: 1;
    overflow: hidden;
}

@media (max-width: 768px) {
    .dashboard-top-section {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .votes-side {
        width: 100% !important;
        height: auto;
    }
}

/* KPI Cards - Unified Density */
.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    /* Compact */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 40px;
    /* Unified size */
    height: 40px;
    /* Unified size */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: white;
    flex-shrink: 0;
}

.kpi-icon-orange {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    /* Login theme orange */
}

.kpi-icon-blue {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    /* Login theme violet */
}

.kpi-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kpi-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
    margin-bottom: 0;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
    margin-bottom: 0;
}

.kpi-status {
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: -2px;
}

.kpi-status {
    font-size: 0.75rem;
    font-weight: 600;
}

.kpi-status-good {
    color: #10b981;
}

.kpi-status-neutral {
    color: #64748b;
}

.kpi-status-bad {
    color: #ef4444;
}

/* Charts Grid - 3 Columns */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Unified for all modern screens */
    gap: 1.25rem;
}

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Chart Card - Compact Header & Body */
.chart-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.2s ease;
}

.chart-card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.chart-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.chart-card-subtitle {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0;
}

.chart-card-body {
    padding: 0.75rem;
}

/* Ratings Card */
.ratings-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Ratings Table - Compact Font & Spacing */
.ratings-card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.ratings-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.ratings-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    /* Force column widths */
}

.ratings-table th,
.ratings-table td {
    padding: 0.22rem 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ratings-table th:nth-child(1),
.ratings-table td:nth-child(1) {
    width: 30px;
}

/* # */
.ratings-table th:nth-child(2),
.ratings-table td:nth-child(2) {
    width: auto;
}

/* Agent */
.ratings-table th:nth-child(3),
.ratings-table td:nth-child(3) {
    width: 65px;
}

/* Note */
.ratings-table th:nth-child(4),
.ratings-table td:nth-child(4) {
    width: 90px;
}

/* Date */

.ratings-table th {
    text-align: left;
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    font-weight: 600;
}

.ratings-table td {
    border-top: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.75rem;
    /* Slightly smaller for sidebar */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card-modern,
.kpi-card,
.chart-card,
.ratings-card {
    animation: fadeIn 0.5s ease-out;
}

/* Departments Modernization */

/* Modern Form Controls */
.form-control-modern {
    display: block;
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b;
    /* slate-800 */
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #e2e8f0;
    /* slate-200, lighter border */
    appearance: none;
    border-radius: 0.5rem;
    /* 8px */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control-modern::placeholder {
    color: #94a3b8;
    /* slate-400 */
    opacity: 1;
}

.form-control-modern:focus {
    color: #1e293b;
    background-color: #fff;
    border-color: #8b5cf6;
    /* violet-500 */
    outline: 0;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    /* Soft violet glow */
}

/* Agent Chips Selection */
.agent-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    /* Pill shape */
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 0.875rem;
    color: #64748b;
    /* slate-500 */
}

.agent-chip:hover {
    background-color: #f8fafc;
    /* slate-50 */
    border-color: #cbd5e1;
    /* slate-300 */
    color: #334155;
    /* slate-700 */
}

.agent-chip.selected {
    background-color: #f5f3ff;
    /* violet-50 */
    border-color: #8b5cf6;
    /* violet-500 */
    color: #7c3aed;
    /* violet-600 */
    font-weight: 500;
}

.agent-chip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.agent-chip.selected .agent-chip-avatar {
    background-color: #8b5cf6;
    color: white;
}

/* Soft Badges */
.badge-soft-success {
    background-color: #dcfce7 !important;
    /* green-100 */
    color: #166534 !important;
    /* green-800 */
}

.badge-soft-danger {
    background-color: #fee2e2 !important;
    /* red-100 */
    color: #991b1b !important;
    /* red-800 */
}

/* Table Refinements */
.modern-table td {
    padding: 1rem 0.75rem !important;
    /* Increased vertical padding */
    vertical-align: middle;
}

/* Bottom Section: Integrated inside .charts-grid */
.charts-grid .votes-table-side {
    grid-column: span 2;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.charts-grid .tags-chart-side {
    width: 100%;
}

.votes-table-side .ratings-card-body {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

@media (max-width: 1200px) {
    .charts-grid .votes-table-side {
        grid-column: span 1;
        /* Stack on smaller screens */
    }
}

.empty-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}