/**
 * Razzball Fantasy Baseball Chatbot - Admin Dashboard
 * Beautiful, animated admin interface with Razzball branding
 */

/* ========================================
   CSS Variables - Razzball Theme
   ======================================== */
:root {
    /* Razzball Brand Colors */
    --primary-color: #003366;
    --primary-dark: #002244;
    --primary-light: #004488;
    --secondary-color: #FF6B35;
    --secondary-dark: #E55A25;
    --secondary-light: #FF8C5A;
    --accent-color: #2E7D32;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --error-color: #F44336;
    --info-color: #2196F3;

    /* Neutrals */
    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E1E8ED;
    --text-primary: #1C2938;
    --text-secondary: #657786;
    --text-light: #AAB8C2;
    --border-color: #E1E8ED;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 51, 102, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 51, 102, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 51, 102, 0.15);
    --shadow-xl: 0 16px 48px rgba(0, 51, 102, 0.2);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #003366 0%, #004488 100%);
    --gradient-secondary: linear-gradient(135deg, #FF6B35 0%, #FF8C5A 100%);
    --gradient-success: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);

    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 80px;
}

/* ========================================
   Global Styles & Reset
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

/* ========================================
   Keyframe Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========================================
   Layout Structure
   ======================================== */
#admin-dashboard {
    display: flex;
    min-height: 100vh;
    animation: fadeIn 0.5s var(--transition-base);
}

/* ========================================
   Sidebar Navigation
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: slideInLeft 0.5s var(--transition-base);
}

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

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInLeft 0.6s var(--transition-base);
}

.logo-icon {
    font-size: 32px;
    animation: pulse 2s ease-in-out infinite;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #FFFFFF 0%, var(--secondary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary-color);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 28px;
}

.nav-item:hover::before {
    transform: scaleY(1);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-icon {
    font-size: 20px;
    transition: transform var(--transition-base);
}

.nav-item:hover .nav-icon {
    transform: scale(1.2);
}

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

.admin-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-md);
}

.admin-details {
    flex: 1;
}

.admin-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.logout-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 12px;
    transition: color var(--transition-fast);
}

.logout-link:hover {
    color: var(--secondary-color);
}

/* ========================================
   Main Content Area
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    animation: fadeIn 0.6s var(--transition-base);
}

.content-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideInUp 0.5s var(--transition-base);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.refresh-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-primary);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.refresh-btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.refresh-btn:hover .refresh-icon {
    animation: rotate 0.5s ease-in-out;
}

.refresh-icon {
    font-size: 20px;
}

.time-display {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 10px 16px;
    background: var(--bg-primary);
    border-radius: 8px;
}

/* ========================================
   View Containers
   ======================================== */
.view-container {
    display: none;
    padding: 32px;
    animation: fadeInScale 0.4s var(--transition-base);
}

.view-container.active {
    display: block;
}

/* ========================================
   Stats Cards (Dashboard)
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    animation: fadeInScale 0.5s var(--transition-base);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card.primary::before {
    background: var(--gradient-primary);
}

.stat-card.secondary::before {
    background: var(--gradient-secondary);
}

.stat-card.accent::before {
    background: var(--gradient-success);
}

.stat-card.success::before {
    background: linear-gradient(135deg, #FF9800 0%, #FFC107 100%);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: var(--bg-primary);
    transition: transform var(--transition-base);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}

.stat-change.positive {
    background: rgba(46, 125, 50, 0.1);
    color: var(--accent-color);
}

.stat-change.neutral {
    background: rgba(33, 150, 243, 0.1);
    color: var(--info-color);
}

/* ========================================
   Charts Section
   ======================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    animation: fadeInScale 0.6s var(--transition-base);
}

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

.chart-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-filter {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chart-filter:hover {
    border-color: var(--primary-color);
}

.chart-container {
    height: 300px;
    position: relative;
}

.query-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.query-item {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
}

.query-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.query-text {
    font-size: 14px;
    font-weight: 500;
}

.query-count {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    background: white;
    border-radius: 12px;
    color: var(--primary-color);
}

/* ========================================
   Activity Card
   ======================================== */
.activity-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    animation: fadeInScale 0.7s var(--transition-base);
}

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

.activity-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.view-all-btn {
    padding: 8px 16px;
    border: none;
    background: var(--bg-primary);
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-all-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 12px;
    transition: all var(--transition-fast);
    animation: fadeInScale 0.3s var(--transition-base);
}

.activity-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.activity-time {
    font-size: 12px;
    opacity: 0.7;
}

/* ========================================
   Users Table
   ======================================== */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 20px;
    animation: slideInUp 0.5s var(--transition-base);
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.filter-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.users-table-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    animation: fadeInScale 0.6s var(--transition-base);
}

.users-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.users-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.users-table tbody tr {
    background: var(--bg-primary);
    transition: all var(--transition-fast);
    animation: fadeInScale 0.3s var(--transition-base);
}

.users-table tbody tr:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
}

.users-table tbody td {
    padding: 16px;
    font-size: 14px;
}

.users-table tbody td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.users-table tbody td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-badge.active {
    background: rgba(46, 125, 50, 0.1);
    color: var(--accent-color);
}

.status-badge.inactive {
    background: rgba(101, 119, 134, 0.1);
    color: var(--text-secondary);
}

.action-btn {
    padding: 6px 12px;
    border: none;
    background: var(--bg-secondary);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   Analytics Cards
   ======================================== */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.analytics-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    animation: fadeInScale 0.5s var(--transition-base);
}

.analytics-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-row span {
    font-size: 14px;
    color: var(--text-secondary);
}

.metric-row strong {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 700;
}

/* ========================================
   Settings
   ======================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.settings-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    animation: fadeInScale 0.5s var(--transition-base);
}

.settings-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.setting-item input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.setting-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.save-settings-btn {
    width: 100%;
    padding: 12px;
    border: none;
    background: var(--gradient-primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.save-settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.toggle-item:last-child {
    border-bottom: none;
}

.toggle-item label {
    font-size: 14px;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 26px;
    transition: all var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-base);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--gradient-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.danger-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--error-color);
    background: transparent;
    color: var(--error-color);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all var(--transition-base);
}

.danger-btn:hover {
    background: var(--error-color);
    color: white;
    transform: translateY(-2px);
}

/* ========================================
   Login Screen
   ======================================== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s var(--transition-base);
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.5s var(--transition-base);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.login-error {
    color: var(--error-color);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-btn {
    width: 100%;
    padding: 14px;
    border: none;
    background: var(--gradient-primary);
    color: white;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-loader {
    animation: rotate 1s linear infinite;
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.3s var(--transition-base);
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.loading-text {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .users-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    transition: background var(--transition-fast);
}

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

/* ========================================
   Message Limits View
   ======================================== */
.limits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.limits-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.limits-summary {
    display: flex;
    gap: 30px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.limits-table-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.limits-table thead {
    background: var(--gradient-primary);
}

.limits-table thead th {
    padding: 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.limits-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.limits-table tbody tr:hover {
    background: var(--bg-primary);
}

.limits-table tbody td {
    padding: 15px;
    font-size: 14px;
    color: var(--text-primary);
}

.action-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: transform var(--transition-fast);
}

.action-btn:hover {
    transform: scale(1.2);
}

.action-btn:active {
    transform: scale(0.95);
}
/* ========================================
   Detail Modals
   ======================================== */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s;
}

.detail-modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s;
}

.detail-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #003366 0%, #004488 100%);
    color: white;
}

.detail-modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.detail-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #003366;
    border-bottom: 2px solid #E1E8ED;
    padding-bottom: 10px;
}

.detail-section p {
    margin: 10px 0;
    color: #1C2938;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.inactive {
    background: #ffebee;
    color: #c62828;
}

.chat-history {
    max-height: 400px;
    overflow-y: auto;
}

.chat-item {
    background: #F5F7FA;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #003366;
}

.chat-timestamp {
    font-size: 12px;
    color: #657786;
    margin-bottom: 8px;
}

.chat-message {
    margin-bottom: 10px;
    color: #1C2938;
}

.chat-response {
    color: #657786;
    font-size: 14px;
}

.message-box {
    background: #F5F7FA;
    padding: 20px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
}

.message-box.user-message {
    border-left: 4px solid #003366;
}

.message-box.bot-message {
    border-left: 4px solid #FF6B35;
}

.detail-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #E1E8ED;
}

.detail-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.detail-actions .btn-primary {
    background: linear-gradient(135deg, #003366 0%, #004488 100%);
    color: white;
}

.detail-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.detail-actions .btn-secondary {
    background: #E1E8ED;
    color: #1C2938;
}

.detail-actions .btn-secondary:hover {
    background: #003366;
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
