/* ============================================
   AUTOPLAY ADMIN DASHBOARD
   Modern, Professional Admin Interface
   ============================================ */

/* CSS Custom Properties */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(26, 26, 37, 0.8);
    --bg-card-hover: rgba(35, 35, 50, 0.9);
    
    /* Accent Colors */
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    --accent-glow: rgba(139, 92, 246, 0.3);
    
    /* Status Colors */
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --warning: #f59e0b;
    --error: #ef4444;
    --live: #ef4444;
    --live-glow: rgba(239, 68, 68, 0.4);
    --info: #3b82f6;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    
    /* Border Colors */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Layout */
.app {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform var(--transition-normal), width var(--transition-normal);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo {
    height: 28px;
    width: auto;
    transition: opacity var(--transition-fast);
}

.logo:hover {
    opacity: 0.8;
}

.admin-badge {
    background: var(--accent-gradient);
    color: white;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
}

.nav-item.active i {
    color: var(--accent-primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.nav-badge.accent {
    background: var(--accent-gradient);
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

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

.admin-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.admin-details {
    display: flex;
    flex-direction: column;
}

.admin-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-role {
    font-size: 11px;
    color: var(--text-muted);
}

.nav-item.logout {
    color: var(--error);
}

.nav-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    flex-shrink: 0;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

.header-left {
    flex: 1;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-search {
    width: 280px;
}

/* User Menu */
.user-menu {
    position: relative;
    margin-left: 8px;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-menu-trigger:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.user-menu-trigger.compact {
    padding: 4px 8px 4px 4px;
    gap: 6px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: white;
}

.user-menu-trigger > i:last-child {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.user-menu.open .user-menu-trigger > i:last-child {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.dropdown-email {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.dropdown-role {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    background: var(--accent-gradient);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    font-size: 13px;
    cursor: pointer;
}

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

.dropdown-item i {
    width: 16px;
    text-align: center;
}

.dropdown-item.logout {
    color: var(--error);
}

.dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   CONTENT WRAPPER & VIEWS
   ============================================ */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-primary);
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ============================================
   DASHBOARD VIEW
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Stats Row */
.stats-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.channels {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
}

.stat-icon.users {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-icon.live {
    background: rgba(239, 68, 68, 0.15);
    color: var(--live);
}

.stat-icon.views {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

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

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--accent-primary);
}

.card-body {
    padding: 20px;
}

.view-all-link {
    font-size: 12px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Quick Actions Card */
.quick-actions-card {
    grid-column: span 2;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.quick-action-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
    font-weight: 500;
}

.quick-action-btn i {
    font-size: 24px;
    color: var(--accent-primary);
}

.quick-action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Live Channels Card */
.live-channels-card {
    grid-column: span 2;
}

.live-channels-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.live-channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.live-channel-item .live-dot {
    width: 8px;
    height: 8px;
    background: var(--live);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Activity Card */
.activity-card {
    grid-column: span 2;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.activity-item .activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 12px;
}

.activity-item .activity-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.activity-item .activity-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Health Card */
.health-card {
    grid-column: span 2;
}

.health-indicators {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.health-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.health-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.health-status {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.health-status i {
    font-size: 8px;
}

.health-status.online {
    color: var(--success);
}

.health-status.offline {
    color: var(--error);
}

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

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 13px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* ============================================
   VIEW TOOLBAR
   ============================================ */
.view-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px 10px 40px;
    color: var(--text-primary);
    font-size: 14px;
    width: 250px;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.filter-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ============================================
   CHANNELS LIST
   ============================================ */
.channels-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    padding: 16px 20px;
    transition: all var(--transition-fast);
    gap: 16px;
}

.channel-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.channel-card.is-live {
    border-left: 3px solid var(--live);
}

.channel-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-logo-letter {
    color: white;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.channel-card-content {
    flex: 1;
    min-width: 0;
}

.channel-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 4px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--live);
    text-transform: uppercase;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--live);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.channel-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.channel-card.is-suspended {
    opacity: 0.7;
    border-color: var(--warning);
}

.channel-card.is-deleted {
    opacity: 0.5;
    border-color: var(--error);
}

.suspended-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.deleted-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   USERS LIST
   ============================================ */
.users-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.user-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.user-email {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.user-role-badge.super_admin {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.user-role-badge.channel_admin {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.user-role-badge.broadcaster {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.user-role-badge.show_moderator {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* ============================================
   ANALYTICS VIEW
   ============================================ */
.date-range-picker {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.date-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.date-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.date-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Analytics Summary */
.analytics-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.analytics-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-fast);
}

.analytics-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.analytics-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.analytics-stat-icon.views {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.analytics-stat-icon.clicks {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.analytics-stat-icon.chat {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.analytics-stat-icon.reactions {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.analytics-stat-info {
    display: flex;
    flex-direction: column;
}

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

.analytics-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-card {
    min-height: 350px;
}

.chart-card .card-body {
    height: 280px;
}

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

/* ============================================
   AI TOOLS VIEW
   ============================================ */
.ai-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.ai-tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    transition: all var(--transition-fast);
}

.ai-tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.tool-icon {
    width: 64px;
    height: 64px;
    background: var(--accent-gradient);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: white;
}

.ai-tool-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.ai-tool-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.ai-job-results {
    margin-top: 24px;
}

.ai-job-results.hidden {
    display: none;
}

/* ============================================
   SETTINGS VIEW
   ============================================ */
.settings-container {
    max-width: 800px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 20px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.settings-section h3 i {
    color: var(--accent-primary);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-actions {
    padding-top: 20px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Role Permissions */
.role-permissions {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--accent-primary);
}

.role-permissions-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.role-permissions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.role-permissions-list li {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-permissions-list li::before {
    content: '✓';
    color: var(--success);
    font-weight: bold;
}

.form-help {
    font-size: 11px;
    color: var(--text-muted);
    margin: 4px 0 8px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--error);
    color: white;
    border: 1px solid var(--error);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* Toggle Filter for showing deleted items */
.toggle-filter {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-filter input[type="checkbox"] {
    display: none;
}

.toggle-filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.toggle-filter input:checked + .toggle-filter-label {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--error);
    color: var(--error);
}

.toggle-filter:hover .toggle-filter-label {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--error);
    color: white;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
}

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

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid transparent;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 640px;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--accent-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

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

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.progress-indicator {
    text-align: center;
    padding: 40px;
}

.progress-indicator .spinner {
    margin: 0 auto 16px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: toastIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast-icon {
    font-size: 18px;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--error);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions-card,
    .live-channels-card,
    .activity-card,
    .health-card {
        grid-column: span 1;
    }
    
    .header-search {
        display: none;
    }
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .view-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .channels-grid,
    .users-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 16px;
    }
    
    .top-header {
        padding: 0 16px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .page-subtitle {
        display: none;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .health-indicators {
        grid-template-columns: 1fr;
    }
    
    .channel-actions-group {
        flex-direction: column;
        gap: 4px;
    }
    
    .channel-actions-group .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   TOGGLE SWITCHES
   ============================================ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

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

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

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

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: white;
}

.toggle-switch:hover .toggle-slider {
    border-color: var(--border-hover);
}

/* Danger toggle (for delete) */
.settings-toggle-item.danger .toggle-switch input:checked + .toggle-slider {
    background-color: var(--error);
    border-color: var(--error);
}

/* ============================================
   CHANNEL SETTINGS MODAL
   ============================================ */
.channel-settings-header {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px;
}

.channel-settings-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.channel-settings-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.settings-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.settings-toggle-item.danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.toggle-info {
    flex: 1;
}

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

.toggle-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ============================================
   SETTINGS EMERGENCY SECTION
   ============================================ */
.settings-section.danger-section {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
    border-radius: var(--border-radius-md);
    padding: 24px;
}

.settings-section.danger-section h3 {
    color: #ef4444;
}

.settings-section.danger-section h3 i {
    margin-right: 8px;
}

.settings-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.emergency-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.emergency-info {
    flex: 1;
}

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

.emergency-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============================================
   CHANNEL FORCE CLOSE SECTION
   ============================================ */
.channel-force-close-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
    margin-top: 20px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.force-close-info {
    flex: 1;
}

.force-close-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #ef4444;
    margin-bottom: 4px;
}

.force-close-label i {
    margin-right: 6px;
}

.force-close-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ============================================
   SWEETALERT2 DARK THEME OVERRIDES
   High specificity selectors for reliable override
   ============================================ */
html body .swal2-container .swal2-popup,
body .swal2-popup.swal2-modal,
.swal2-popup {
    background: #12121a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7) !important;
    padding: 32px !important;
    color: #ffffff !important;
}

html body .swal2-container .swal2-popup .swal2-title,
.swal2-title {
    color: #ffffff !important;
    font-size: 22px !important;
    font-weight: 600 !important;
    padding: 0 !important;
    margin-bottom: 16px !important;
}

html body .swal2-container .swal2-popup .swal2-html-container,
.swal2-html-container {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    padding: 0 16px !important;
}

.swal2-html-container p {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.7) !important;
}

.swal2-html-container ul {
    text-align: left;
    margin: 12px 0;
    padding-left: 24px;
    color: rgba(255, 255, 255, 0.7) !important;
}

.swal2-html-container li {
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.7) !important;
}

.swal2-html-container strong {
    color: #ffffff !important;
    font-weight: 600;
}

/* Warning/Error icon styling */
html body .swal2-container .swal2-popup .swal2-icon,
.swal2-icon {
    margin: 0 auto 24px !important;
    width: 72px !important;
    height: 72px !important;
}

html body .swal2-icon.swal2-warning,
.swal2-icon.swal2-warning {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
}

.swal2-icon.swal2-warning .swal2-icon-content {
    color: #f59e0b !important;
    font-size: 48px !important;
}

html body .swal2-icon.swal2-error,
.swal2-icon.swal2-error {
    border-color: #ef4444 !important;
}

.swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
    background-color: #ef4444 !important;
}

html body .swal2-icon.swal2-success,
.swal2-icon.swal2-success {
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.swal2-icon.swal2-success [class^='swal2-success-line'] {
    background-color: #10b981 !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.swal2-icon.swal2-info {
    border-color: #8b5cf6 !important;
    color: #8b5cf6 !important;
}

/* Actions/Buttons container */
html body .swal2-container .swal2-popup .swal2-actions,
.swal2-actions {
    margin-top: 28px !important;
    gap: 12px !important;
}

/* Confirm button - Danger style */
html body .swal2-container .swal2-popup .swal2-actions button.swal2-confirm,
button.swal2-confirm,
.swal2-confirm {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 28px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4) !important;
    transition: all 0.15s ease !important;
    outline: none !important;
}

button.swal2-confirm:hover,
.swal2-confirm:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5) !important;
}

button.swal2-confirm:focus,
.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3), 0 4px 14px rgba(239, 68, 68, 0.4) !important;
}

/* Cancel button */
html body .swal2-container .swal2-popup .swal2-actions button.swal2-cancel,
button.swal2-cancel,
.swal2-cancel {
    background: #1a1a25 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    padding: 12px 28px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    transition: all 0.15s ease !important;
    outline: none !important;
}

button.swal2-cancel:hover,
.swal2-cancel:hover {
    background: #252532 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px) !important;
}

button.swal2-cancel:focus,
.swal2-cancel:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
}

/* Deny button (if used) */
button.swal2-deny,
.swal2-deny {
    background: #1a1a25 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    padding: 12px 28px !important;
    font-size: 14px !important;
    color: #ffffff !important;
}

/* Backdrop */
html body .swal2-container.swal2-backdrop-show,
.swal2-backdrop-show,
.swal2-container {
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

/* Close button */
.swal2-close {
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 28px !important;
    transition: color 0.15s ease !important;
}

.swal2-close:hover {
    color: #ffffff !important;
}

/* Toast notifications */
.swal2-popup.swal2-toast {
    background: #12121a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    padding: 12px 16px !important;
}

.swal2-popup.swal2-toast .swal2-title {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #ffffff !important;
}

/* Loading state */
.swal2-loading .swal2-confirm,
.swal2-loading button.swal2-confirm {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
}

/* Timer progress bar */
.swal2-timer-progress-bar {
    background: #8b5cf6 !important;
}

/* Input fields in SweetAlert */
.swal2-input,
.swal2-textarea,
.swal2-select {
    background: #1a1a25 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    font-size: 14px !important;
    padding: 12px 16px !important;
}

.swal2-input:focus,
.swal2-textarea:focus,
.swal2-select:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3) !important;
    outline: none !important;
}

.swal2-input::placeholder,
.swal2-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Validation message */
.swal2-validation-message {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
}

/* ============================================
   SKELETON LOADING STATES
   ============================================ */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 14px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text.lg {
    height: 32px;
    width: 80px;
}

.skeleton-text.md {
    height: 20px;
    width: 120px;
}

.skeleton-text.sm {
    height: 12px;
    width: 80px;
}

/* Analytics Summary Skeleton */
.analytics-stat-card.skeleton-card {
    pointer-events: none;
}

.analytics-stat-card.skeleton-card .analytics-stat-icon {
    background: rgba(255, 255, 255, 0.04);
}

.analytics-stat-card.skeleton-card .analytics-stat-icon i {
    opacity: 0.2;
}

.skeleton-stat-value {
    height: 36px;
    width: 70px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.skeleton-stat-label {
    height: 14px;
    width: 90px;
    border-radius: 4px;
}

/* Chart Card Skeleton */
.chart-card.skeleton-chart .card-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.skeleton-chart-placeholder {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton-chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 100%;
    padding: 20px;
    gap: 8px;
}

.skeleton-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    max-width: 40px;
}

.skeleton-chart-line {
    position: absolute;
    bottom: 30%;
    left: 10%;
    right: 10%;
    height: 3px;
    border-radius: 2px;
}

.skeleton-chart-line::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 100%;
    background: inherit;
    transform: rotate(-5deg);
    transform-origin: left center;
}

/* Table Skeleton */
.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.skeleton-table-cell {
    height: 16px;
    border-radius: 4px;
}

.skeleton-table-cell.url {
    flex: 3;
}

.skeleton-table-cell.channel {
    flex: 1;
}

.skeleton-table-cell.clicks {
    width: 50px;
}

.skeleton-table-cell.time {
    width: 70px;
}

/* Hide skeleton when loaded */
.analytics-loaded .skeleton-card,
.analytics-loaded .skeleton-chart,
.analytics-loaded .skeleton-content {
    display: none;
}

.analytics-summary:not(.analytics-loaded) .real-stat-card,
.analytics-grid:not(.analytics-loaded) .real-chart {
    display: none;
}

/* ============================================
   ANALYTICS - DATE PICKER
   ============================================ */
.date-picker-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.date-picker-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px 8px 36px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.date-picker-input:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.date-picker-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.date-picker-icon {
    position: absolute;
    left: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    pointer-events: none;
}

/* Custom calendar styling */
.date-picker-input::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(0.7);
    cursor: pointer;
}

/* ============================================
   ANALYTICS - VIEWER TIME CHART
   ============================================ */
.viewer-time-chart {
    grid-column: span 1;
}

@media (min-width: 1200px) {
    .viewer-time-chart {
        grid-column: span 1;
    }
}

/* ============================================
   ANALYTICS - CLICKED URLs TABLE
   ============================================ */
.clicked-urls-card {
    grid-column: span 1;
}

@media (min-width: 1200px) {
    .clicked-urls-card {
        grid-column: span 1;
    }
}

.clicked-urls-list {
    max-height: 350px;
    overflow-y: auto;
}

.clicked-urls-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.clicked-urls-table thead {
    position: sticky;
    top: 0;
    background: #12121a;
    z-index: 1;
}

.clicked-urls-table th {
    text-align: left;
    padding: 12px 8px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.clicked-urls-table td {
    padding: 10px 8px;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.clicked-urls-table tbody tr:hover {
    background: rgba(139, 92, 246, 0.08);
}

.clicked-urls-table .url-cell {
    max-width: 200px;
}

.clicked-urls-table .url-cell a {
    color: #8b5cf6;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.clicked-urls-table .url-cell a:hover {
    color: #a78bfa;
    text-decoration: underline;
}

.clicked-urls-table .url-cell a i {
    font-size: 10px;
    opacity: 0.7;
}

.clicked-urls-table .clicks-cell {
    text-align: center;
    font-weight: 600;
    color: #10b981;
    min-width: 60px;
}

.clicked-urls-table .time-cell {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    white-space: nowrap;
}

/* Scrollbar styling for clicked URLs list */
.clicked-urls-list::-webkit-scrollbar {
    width: 6px;
}

.clicked-urls-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.clicked-urls-list::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

.clicked-urls-list::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Empty state in cards */
.clicked-urls-list .empty-state,
.viewer-time-chart .empty-state {
    padding: 40px 20px;
}

.clicked-urls-list .empty-state i,
.viewer-time-chart .empty-state i {
    font-size: 32px;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 12px;
}

.clicked-urls-list .empty-state p {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}
