/* Admin Panel Styles for Aristos */

:root {
    --primary-color: #D4AF37;
    --primary-light: rgba(212, 175, 55, 0.1);
    --dark-color: #1a1a1a;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: var(--primary-color);
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --gold-gradient: linear-gradient(170deg, #D5B65B 0%, #A27E2F 30%, #F3E392 50%, #A98533 70%, #E3C873 100%);
    --gold-gradient-reverse: linear-gradient(170deg, #E3C873 0%, #A98533 30%, #F3E392 50%, #A27E2F 70%, #D5B65B 100%);
    --shadow-gold: 0 5px 15px rgba(212, 175, 55, 0.2);
    --shadow-gold-hover: 0 8px 25px rgba(212, 175, 55, 0.3);
    --border-radius: 8px;
}

/* Ensure Bootstrap modal/backdrop are above any overlays */
.modal-backdrop {
    z-index: 9990 !important;
}
.modal {
    z-index: 9995 !important;
    pointer-events: auto !important;
}
.modal .modal-dialog {
    pointer-events: auto !important;
    position: relative;
    z-index: 10000 !important;
}

/* Ghost scrollbar styling for modal body */
.modal .modal-body {
    max-height: 70vh;
    overflow: auto;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(212, 175, 55, 0.5) transparent; /* Firefox */
}
.modal .modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.modal .modal-body::-webkit-scrollbar-thumb {
    background-color: rgba(212, 175, 55, 0.5); /* gold, semi-transparent */
    border-radius: 4px;
}
.modal .modal-body:hover::-webkit-scrollbar-thumb {
    background-color: rgba(212, 175, 55, 0.8);
}

/* Sidebar Overlay (for both mobile and desktop) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    /* Place overlay below Bootstrap modal/backdrop (1055/1050) to avoid blocking modals */
    z-index: 1040;
    display: none;
    cursor: pointer;
}

.sidebar-overlay.show {
    display: block;
}

/* PWA Install Button */
#pwaInstallBtn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    padding: 6px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
}

#pwaInstallBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

/* User dropdown positioning fix */
.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #2c2c2c;
    border: 1px solid #444;
    border-radius: 6px;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    margin-top: 8px;
}

.user-menu-dropdown a {
    display: block;
    padding: 12px 16px;
    color: #f8f9fa;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.user-menu-dropdown a:hover {
    background-color: rgba(212, 175, 55, 0.1);
    color: #D4AF37;
}

.user-menu-dropdown .divider {
    height: 1px;
    background: #444;
    margin: 8px 0;
}

.user-menu-dropdown .user-info-header {
    padding: 12px 16px;
    font-weight: 600;
    color: #D4AF37;
    border-bottom: 1px solid #444;
}

/* Base Styles */
body {
    font-family: 'Montserrat', sans-serif;
    background-color: #1a1a1a;
    color: #f8f9fa;
    margin: 0;
    padding: 0;
    /* Prevent any horizontal overflow from fixed sidebar + margins */
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

a:hover {
    color: #b08f26;
}

/* Admin Wrapper */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: #111111;
    background-image: linear-gradient(180deg, #0a0a0a 0%, #141414 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    /* Place above header so its top isn't hidden */
    z-index: 1400;
    border-right: 1px solid rgba(212, 175, 55, 0.1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed {
    /* On desktop, hide sidebar completely */
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.08);
    background-color: rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

.logo-aristos {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 4px;
    background-image: var(--gold-gradient);
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    text-shadow: 0 0 10px rgba(255, 215, 100, 0.4), 0px 1px 1px rgba(255, 245, 200, 0.5), 0px -1px 1px rgba(0, 0, 0, 0.5);
    margin-bottom: 5px;
    position: relative;
    display: inline-block;
}

.admin-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.7;
    font-weight: 500;
    color: #a0a0a0;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-item {
    margin: 0;
    position: relative;
}

.menu-item a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 2px 15px;
    justify-content: flex-start !important;
    text-align: left !important;
}

.menu-item a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    font-size: 16px;
    transition: all 0.3s ease;
    opacity: 0.85;
}

.menu-item a:hover {
    background-color: rgba(212, 175, 55, 0.08);
    color: #ffffff;
}

.menu-item a:hover i {
    color: var(--primary-color);
    opacity: 1;
    transform: translateX(2px);
}

.menu-item.active a {
    color: #ffffff;
    font-weight: 600;
    background-color: rgba(212, 175, 55, 0.15);
    border-left: 3px solid var(--primary-color);
    padding-left: 22px;
}

.menu-item.active a i {
    color: var(--primary-color);
    opacity: 1;
}

.menu-item.logout {
    margin-top: auto;
    border-top: 1px solid rgba(212, 175, 55, 0.08);
    padding-top: 10px;
    margin-top: 30px;
}

.menu-item.logout a {
    color: #e57373;
}

.menu-item.logout a:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #ff6b6b;
}

.menu-item.logout a:hover i {
    color: #ff6b6b;
    transform: translateX(2px);
}

/* When sidebar is collapsed */
.sidebar.collapsed .sidebar-header {
    padding: 15px 5px;
}

.sidebar.collapsed .admin-label,
.sidebar.collapsed .menu-item a span {
    display: none;
}

.sidebar.collapsed .menu-item a {
    padding: 15px;
    justify-content: center;
}

.sidebar.collapsed .menu-item a i {
    margin-right: 0;
    font-size: 18px;
}

/* Mobile sidebar behavior */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        overflow-x: hidden;
    }
    
    .sidebar.collapsed {
        transform: translateX(0);
        width: var(--sidebar-width);
        overflow-x: visible;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .main-content.expanded {
        margin-left: 0;
        width: 100%;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    /* Account for fixed sidebar so content doesn't overflow to the right */
    width: calc(100% - var(--sidebar-width));
    transition: all 0.3s ease;
    min-height: 100vh;
}

.main-content.expanded {
    /* When sidebar is collapsed on desktop, expand to full width */
    margin-left: 0;
    width: 100%;
}

/* Footer */
.admin-footer {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 15px 20px;
}

/* Keep footer exactly aligned with content padding */
.admin-footer .container-fluid {
    padding-left: 0;
    padding-right: 0;
}

/* When sidebar is collapsed (desktop), adjust footer to match content */
.admin-wrapper .main-content.expanded ~ .admin-footer {
    margin-left: 0;
    width: 100%;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    background-color: #222;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    /* Keep hamburger above sidebar (sidebar z-index is 1000) */
    z-index: 1200;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    /* Keep toggle clickable above the sidebar */
    position: relative;
    z-index: 1500;
}

.sidebar-toggle:hover {
    color: var(--dark-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notifications {
    margin-right: 20px;
    position: relative;
}

.notification-icon {
    color: var(--primary-color);
    font-size: 18px;
}

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative; /* anchor for dropdown */
}

.user-profile img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

/* When using an icon instead of an image for the avatar */
.user-profile .avatar-icon {
    font-size: 32px;
    color: var(--primary-color);
    margin-right: 10px;
    line-height: 1;
}

.user-profile span {
    font-weight: 600;
    margin-right: 5px;
}

.admin-user-text {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 1px;
    background-image: var(--gold-gradient);
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    text-shadow: 0 0 5px rgba(255, 215, 100, 0.3);
}

/* User menu dropdown */
.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    background: #1f1f1f;
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
    padding: 8px 0;
    display: none;
    z-index: 1500; /* above header, below toggle */
}

.user-menu-dropdown.show { display: block; }

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #e9ecef;
    font-size: 14px;
}

.user-menu-dropdown a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--primary-color);
}

.user-menu-dropdown .divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 6px 0;
}

/* Notification dropdown dark theme adjustments */
.notification-dropdown {
    background-color: #222;
    color: #e9ecef;
    border: 1px solid rgba(212, 175, 55, 0.15);
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
    z-index: 1450; /* above header, below user menu */
}

.notification-dropdown .dropdown-header,
.notification-dropdown .dropdown-footer {
    background: #1a1a1a;
    border-color: rgba(212, 175, 55, 0.1);
}

.notification-item { border-bottom-color: rgba(255,255,255,0.08); }
.notification-item:hover { background-color: rgba(255,255,255,0.04); }
.notification-content p { color: #c7c7c7; }
.dropdown-footer a { color: var(--primary-color); }

/* Dashboard Content */
.dashboard-content {
    padding: 20px;
    background-color: #1a1a1a;
}

.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #f8f9fa;
}

.page-header p {
    margin: 5px 0 0;
    color: var(--gray-color);
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background-color: transparent;
    border: 1px solid #555;
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: #777;
    background-color: rgba(255, 255, 255, 0.05);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 24px;
    border: 1px solid #555;
}

.stat-details h3 {
    margin: 0;
    font-size: 14px;
    color: var(--gray-color);
    font-weight: 600;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    margin: 5px 0;
}

.stat-change {
    font-size: 12px;
    margin: 0;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

.stat-change.neutral {
    color: var(--info-color);
}

/* Dashboard Row */
.dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

/* Dashboard Cards */
.dashboard-card {
    background-color: #222;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-gold);
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* New: unify styling for PHP templates using .data-card */
.data-card {
    background-color: #222;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-gold);
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-gold-hover);
}

.data-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-gold-hover);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #1a1a1a;
}

.card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #f8f9fa;
}

.view-all {
    font-size: 14px;
    color: var(--primary-color);
}

.card-body {
    padding: 20px;
}

/* Recent Activity */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.activity-icon.published {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.activity-icon.edited {
    background-color: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
}

.activity-icon.blaze {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

.activity-icon.subscriber {
    background-color: rgba(212, 175, 55, 0.1);
    color: var(--primary-color);
}

.activity-details {
    flex: 1;
}

.activity-text {
    margin: 0 0 5px;
    font-size: 14px;
}

.activity-time {
    margin: 0;
    font-size: 12px;
    color: var(--gray-color);
}

/* Blaze Queue */
.queue-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.queue-item {
    display: flex;
    align-items: flex-start;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.queue-status {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.queue-status.pending {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

.queue-status.approved {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.queue-status.rejected {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.queue-details {
    flex: 1;
}

.queue-details h4 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
}

.queue-meta {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.queue-category {
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 10px;
}

.queue-date {
    font-size: 12px;
    color: var(--gray-color);
}

.queue-actions {
    display: flex;
    gap: 10px;
}

/* Analytics Chart */
.analytics-chart { height: 100%; }

.chart-period {
    display: flex;
    align-items: center;
}

.period-btn {
    background: none;
    border: none;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--gray-color);
}

.period-btn.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Ensure the traffic chart scales to its container */
.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

#trafficChart,
.chart-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 576px) {
    .chart-container { height: 240px; }
}

/* Popular Posts */
.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.popular-rank {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 15px;
    flex-shrink: 0;
}

.popular-details {
    flex: 1;
}

.popular-details h4 {
    margin: 0 0 5px;
    font-size: 14px;
    font-weight: 600;
}

.popular-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.popular-meta span {
    font-size: 12px;
    color: var(--gray-color);
    display: flex;
    align-items: center;
}

.popular-meta span i {
    margin-right: 5px;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar .admin-label,
    .sidebar .menu-item a span {
        display: none;
    }
    
    .sidebar .menu-item a {
        padding: 15px;
        justify-content: center;
    }
    
    .sidebar .menu-item a i {
        margin-right: 0;
        font-size: 18px;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }

    .admin-footer {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    /* Mobile sidebar styling */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: var(--sidebar-width);
        z-index: 1400;
        transition: transform 0.3s ease;
        background-color: var(--sidebar-bg, #1a1a2e);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }
    
    /* When toggled, show the sidebar */
    .sidebar.collapsed {
        transform: translateX(0);
    }
    
    /* Mobile hamburger should look like desktop */
    .sidebar-toggle {
        position: relative; /* same as desktop */
        z-index: 1500;      /* keep above sidebar */
        background: none;
        border: none;
        color: var(--primary-color);
        padding: 5px;
        width: auto;
        height: auto;
        border-radius: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    
    /* Show text labels on mobile */
    .sidebar .admin-label {
        display: block;
    }
    
    .sidebar .menu-item a span {
        display: inline;
    }
    
    /* Left-align menu items on mobile */
    .sidebar .menu-item a {
        padding: 12px 25px; /* match desktop spacing */
        justify-content: flex-start; /* left-align like desktop */
        text-align: left;
    }
    
    .sidebar .menu-item a i {
        margin-right: 15px; /* match desktop icon spacing */
        font-size: 18px;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* On mobile, footer should span full width (sidebar is off-canvas) */
    .admin-footer {
        margin-left: 0;
        width: 100%;
    }
    
    /* Hide fullscreen button on mobile */
    .fullscreen-toggle {
        display: none !important;
    }
    
    /* Ensure content doesn't shift when sidebar appears */
    body.sidebar-visible .main-content {
        margin-left: 0;
    }
    
    /* Overlay to close sidebar when clicked outside */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }
    
    body.sidebar-visible .sidebar-overlay {
        display: block;
    }
}

/* Subscriber Analytics Styles */
.subscriber-metric-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    text-align: center;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.subscriber-metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.subscriber-metric-card h5 {
    color: #555;
    font-size: 1rem;
    margin-bottom: 10px;
}

.subscriber-metric-card .metric-number {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #333;
}

.subscriber-metric-card .metric-trend {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0;
}

.subscriber-metric-card .metric-trend.up {
    color: var(--success-color);
}

.subscriber-metric-card .metric-trend.down {
    color: var(--danger-color);
}

.subscriber-metric-card .metric-trend i {
    margin-right: 3px;
}

/* Form Element Styles */

/* Common form control styles */
.form-control,
.form-select,
.input-group-text {
    height: 50px;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-family: 'Montserrat', sans-serif;
    background-color: #333;
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: #f8f9fa;
    transition: all 0.3s ease;
}

/* Textarea specific styles */
textarea.form-control {
    height: auto;
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* Focus states for all form elements */
.form-control:focus,
.form-select:focus {
    background-color: #333;
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.25);
    color: #f8f9fa;
}

/* Input group styling */
.input-group-text {
    background-color: #222;
    border-color: rgba(212, 175, 55, 0.2);
    color: var(--primary-color);
}

/* Form labels */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #f8f9fa;
}

/* Help text on dark backgrounds */
small.text-muted,
.form-text,
.text-muted {
    color: rgba(255, 255, 255, 0.65) !important;
}

/* Select dropdown styling */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23D4AF37' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-select:focus {
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.25);
}

/* Checkbox and radio styling */
.form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.25em;
    background-color: #333;
    border: 1px solid rgba(212, 175, 55, 0.3);
    transition: all 0.2s ease-in-out;
}

.form-check-input[type="checkbox"] {
    border-radius: 0.25em;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.25);
}

.form-check-label {
    color: #f8f9fa;
    padding-left: 0.25rem;
}

/* Form validation states */
.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Form buttons */
.btn-primary {
    background-image: var(--gold-gradient);
    border: none;
    color: #333;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold-hover);
    background-image: var(--gold-gradient-reverse);
}

.btn-secondary {
    background-color: #444;
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: #f8f9fa;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* File input styling */
.form-control[type="file"] {
    padding: 0.375rem 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.15);
    background-color: rgba(51, 51, 51, 0.5);
}

.form-control[type="file"]:not(:disabled):not([readonly]) {
    cursor: pointer;
}

/* Custom file input styling */
.form-control[type="file"]::-webkit-file-upload-button,
.form-control[type="file"]::file-selector-button {
    padding: 0.375rem 0.75rem;
    margin: -0.375rem -0.75rem;
    margin-inline-end: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    background-color: rgba(68, 68, 68, 0.5);
    pointer-events: none;
    border-color: inherit;
    border-style: solid;
    border-width: 0;
    border-inline-end-width: 1px;
    border-radius: 0;
    transition: all 0.3s ease-in-out;
}

.form-control[type="file"]:hover::-webkit-file-upload-button,
.form-control[type="file"]:hover::file-selector-button {
    background-color: rgba(85, 85, 85, 0.5);
    color: var(--primary-color);
}

.form-control[type="file"]:focus {
    border-color: rgba(212, 175, 55, 0.4);
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.15);
}

/* Range input styling */
.form-range {
    height: 1.5rem;
    padding: 0;
    background-color: transparent;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 1rem;
    height: 1rem;
    background-color: var(--primary-color);
    border: 0;
    border-radius: 1rem;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-range::-webkit-slider-thumb:active {
    background-color: rgba(212, 175, 55, 0.8);
}

.form-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.5rem;
    color: transparent;
    cursor: pointer;
    background-color: #444;
    border-color: transparent;
    border-radius: 1rem;
}

/* Nav Tabs Styling */
.nav-tabs {
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.nav-tabs .nav-link {
    color: #f8f9fa;
    border: none;
    border-bottom: 2px solid transparent;
    background-color: transparent;
    padding: 0.75rem 1rem;
    margin-bottom: -1px;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-color: transparent;
    background-color: rgba(212, 175, 55, 0.05);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: transparent;
    border-color: transparent;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
}

/* Notification System Styles */
.notification-icon {
    position: relative;
    cursor: pointer;
}

.notification-icon .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    overflow: hidden;
    margin-top: 10px;
}

.notification-dropdown.show {
    display: block;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.dropdown-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.dropdown-header .clear-all {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    cursor: pointer;
}

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

.notification-item {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: #f9f9f9;
}

.notification-item.unread {
    background-color: rgba(212, 175, 55, 0.05);
}

.notification-item .notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.notification-item .notification-icon.success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.notification-item .notification-icon.error {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.notification-item .notification-icon.info {
    background-color: rgba(212, 175, 55, 0.1);
    color: #D4AF37;
}

.notification-item .notification-icon.warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.notification-content {
    flex: 1;
}

.notification-content h4 {
    margin: 0 0 5px;
    font-size: 14px;
    font-weight: 600;
}

.notification-content p {
    margin: 0 0 5px;
    font-size: 13px;
    color: #666;
}

.notification-time {
    font-size: 11px;
    color: #999;
}

.notification-close {
    background: none;
    border: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.notification-item:hover .notification-close {
    opacity: 1;
}

.empty-notifications {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.dropdown-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #eee;
}

.dropdown-footer a {
    color: var(--primary-color);
    font-size: 12px;
    text-decoration: none;
}

.dropdown-footer a:hover {
    text-decoration: underline;
}

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    min-width: 300px;
    max-width: 450px;
    animation: slideIn 0.3s ease-out forwards;
}

.toast.success { background-color: #28a745; }
.toast.error { background-color: #dc3545; }
.toast.info { background-color: #D4AF37; }
.toast.warning { background-color: #ffc107; color: #333; }

.toast-icon {
    margin-right: 15px;
    font-size: 20px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    margin-left: 10px;
}

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

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

/* Notifications Page Styles */
.notifications-list {
    max-height: 600px;
    overflow-y: auto;
}

.notifications-list .notification-item {
    padding: 20px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.notifications-list .notification-item:last-child {
    border-bottom: none;
}

.notifications-list .notification-item:hover {
    background-color: #f9f9f9;
}

.notifications-list .notification-item.unread {
    background-color: rgba(212, 175, 55, 0.05);
}

.notification-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.notification-header .notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.notification-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.notification-time {
    font-size: 12px;
    color: #999;
    margin-left: 10px;
}

.notification-content p {
    margin: 0 0 15px;
    font-size: 14px;
    color: #666;
}

.notification-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.notification-controls {
    background-color: #fff;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Admin Modal Adjustments: keep modals above the sticky header and positioned lower */
/* Raise z-index above header (header z-index: 1200) */
.modal-backdrop {
    z-index: 1550 !important;
}

.modal {
    z-index: 1560 !important;
}

/* Offset modal vertically so its header is not hidden behind the sticky top bar */
.modal .modal-dialog {
    margin-top: calc(var(--header-height) + 16px);
}

/* Small screens: give a bit more breathing room */
@media (max-width: 576px) {
    .modal .modal-dialog {
        margin-top: calc(var(--header-height) + 8px);
    }
}

.notification-filters .btn-group {
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .notification-controls .col-md-6 {
        text-align: center !important;
        margin-bottom: 10px;
    }
}

.empty-state {
    padding: 50px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 20px;
}

.empty-state h4 {
    font-size: 20px;
    margin-bottom: 10px;
}

.empty-state p {
    color: #999;
}

/* Subscribers Page Enhancements */
.filters-bar {
    background-color: #222;
    border: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    box-shadow: var(--shadow-gold);
}

.subscribers-table thead th {
    background-color: #1a1a1a;
    color: #f8f9fa;
    border-color: rgba(212, 175, 55, 0.2);
}

.subscribers-table tbody tr {
    background-color: #333333;
    color: #f8f9fa;
}

.subscribers-table tbody tr:hover {
    background-color: #444444;
}

.subscribers-table .action-buttons .btn-info {
    background-color: transparent;
    border: 1px solid #555;
    color: #aaa;
}

.subscribers-table .action-buttons .btn-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.raw-json {
    background-color: #111;
    color: #e9ecef;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

/* Ghost/muted styling for pagination */
.pagination .page-item .page-link {
    background-color: transparent;
    border-color: #555;
    color: #aaa;
}

.pagination .page-item.active .page-link {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #555;
    color: #fff;
}

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

.pagination .page-item.disabled .page-link {
    background-color: transparent;
    border-color: #444;
    color: #666;
}

/* Modal Styling Enhancements */
.modal-content {
    background-color: #222;
    color: #f8f9fa;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.modal-header {
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body h5 {
    color: #d4af37;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body h6 {
    color: #d4af37;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.modal-body .table {
    color: #f8f9fa;
    margin-bottom: 0;
}

.modal-body .table th {
    width: 30%;
    color: #aaa;
    font-weight: normal;
    border-color: rgba(255, 255, 255, 0.1);
}

.modal-body .table td {
    border-color: rgba(255, 255, 255, 0.1);
}

.modal-body .bg-light {
    background-color: #333 !important;
    color: #f8f9fa;
    padding: 1rem !important;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-body p strong {
    color: #aaa;
    font-weight: normal;
    display: inline-block;
    width: 160px;
}

.modal-lg {
    max-width: 800px;
}

.list-group-item {
    background-color: #333;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8f9fa;
}

.modal-body .row + .row {
    margin-top: 1.5rem;
}

/* Copy button styling */
#modalCopyJson {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* ==========================================
    Responsive Tables -> Card Layout (Mobile)
    Apply to any table with class .table-card
    ========================================== */
.table-card {
    width: 100%;
}

/* Base dark styling stays as-is on desktop */
@media (max-width: 768px) {
    .table-responsive { overflow-x: visible; }
    .table-card thead {
        display: none;
    }
    .table-card tbody,
    .table-card tr,
    .table-card td {
        display: block;
        width: 100%;
    }
    .table-card tr {
        background-color: #333;
        color: #f8f9fa;
        border: 1px solid rgba(212, 175, 55, 0.15);
        border-radius: var(--border-radius, 8px);
        margin-bottom: 12px;
        box-shadow: var(--shadow-gold, 0 2px 8px rgba(212,175,55,0.08));
    }
    .table-card td {
        position: relative;
        padding-left: 48%;
        border: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }
    .table-card td:last-child {
        border-bottom: none !important;
    }
    .table-card td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 40%;
        padding-right: 10px;
        white-space: normal;
        color: #d4af37;
        font-weight: 600;
        opacity: 0.95;
    }
    /* Checkbox and action cells adjustments */
    .table-card td .form-check,
    .table-card td .action-buttons,
    .table-card td .btn-group {
        margin-top: 4px;
    }
    .table-card .badge { vertical-align: middle; }
    .table-card td .action-buttons .btn { margin-right: 6px; margin-bottom: 6px; }
    .table-card .post-title-cell { display: flex; gap: 10px; align-items: center; }
    .table-card .post-title-cell .post-image img { max-width: 64px; height: auto; border-radius: 4px; }
}

/* ==========================================
   Leads Pipeline (Kanban) Styles
   ========================================== */
.pipeline-wrapper {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-x: auto;
    padding: 8px 4px 12px;
}

.pipeline-stage {
    background-color: #222;
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: var(--border-radius);
    min-width: 260px;
    max-width: 320px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.pipeline-stage .stage-header {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.12);
    color: var(--primary-color);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.pipeline-stage .stage-drop {
    min-height: 200px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pipeline-stage .stage-drop.over {
    outline: 2px dashed rgba(212, 175, 55, 0.45);
    outline-offset: -6px;
    background-color: rgba(212, 175, 55, 0.05);
}

.lead-card {
    background-color: #2b2b2b;
    color: #f8f9fa;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    cursor: grab;
    user-select: none;
}

.lead-card:active { cursor: grabbing; }

.lead-card .lead-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.lead-card .lead-sub {
    color: #c9c9c9;
    font-size: 0.9rem;
}

.lead-card.dragging {
    opacity: 0.65;
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .pipeline-stage {
        min-width: 240px;
    }
    
    .sidebar {
        overflow-x: hidden;
    }
}
