/**
 * IPTV Management System - Modern Clean UI
 * Clean design with Dark Mode support
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

/* CSS Variables */
:root {
    /* Core Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Transitions */
    --transition: all 0.2s ease-in-out;

    /* LIGHT MODE (Default) */
    --bg-body: #f9fafb;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f3f4f6;
    --bg-navbar: #ffffff;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-navbar: #374151;
    --text-navbar-hover: #111827;
    --text-inverse: #ffffff;

    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.1);

    --link-color: #4f46e5;
    --link-hover: #4338ca;

    /* Badge/Alert Backgrounds (Light) */
    --bg-primary-light: #eef2ff;
    --bg-success-light: #d1fae5;
    --bg-warning-light: #fef3c7;
    --bg-danger-light: #fee2e2;
    --bg-info-light: #dbeafe;

    /* Badge Text Colors (Light) */
    --text-primary-dark: #4338ca;
    --text-success-dark: #065f46;
    --text-warning-dark: #92400e;
    --text-danger-dark: #991b1b;
    --text-info-dark: #1e40af;
}

[data-theme="dark"] {
    /* DARK MODE Overrides */
    --bg-body: #111827;
    /* gray-900 */
    --bg-card: #1f2937;
    /* gray-800 */
    --bg-input: #374151;
    /* gray-700 */
    --bg-hover: #374151;
    /* gray-700 */
    --bg-navbar: #1f2937;
    /* gray-800 */

    --text-primary: #f9fafb;
    /* gray-50 */
    --text-secondary: #d1d5db;
    /* gray-300 */
    --text-muted: #9ca3af;
    /* gray-400 */
    --text-navbar: #f9fafb;
    --text-navbar-hover: #ffffff;
    --text-inverse: #ffffff;

    --border-color: #374151;
    /* gray-700 */
    --shadow-color: rgba(0, 0, 0, 0.5);

    --link-color: #818cf8;
    --link-hover: #a5b4fc;

    /* Badge/Alert Backgrounds (Dark - Transparent) */
    --bg-primary-light: rgba(79, 70, 229, 0.2);
    --bg-success-light: rgba(16, 185, 129, 0.2);
    --bg-warning-light: rgba(245, 158, 11, 0.2);
    --bg-danger-light: rgba(239, 68, 68, 0.2);
    --bg-info-light: rgba(59, 130, 246, 0.2);

    /* Badge Text Colors (Dark - Light) */
    --text-primary-dark: #a5b4fc;
    --text-success-dark: #6ee7b7;
    --text-warning-dark: #fcd34d;
    --text-danger-dark: #fca5a5;
    --text-info-dark: #93c5fd;
}

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
}

p {
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

small {
    color: var(--text-secondary);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--link-hover);
}

/* Navbar */
.navbar {
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-4) var(--space-8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px var(--shadow-color);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-navbar) !important;
}

.navbar-menu {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.navbar-menu a {
    color: var(--text-navbar);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
}

.navbar-menu a:hover {
    background: var(--bg-hover);
    color: var(--text-navbar-hover);
}

.navbar-menu a.active {
    background: var(--primary);
    color: var(--text-inverse) !important;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    margin-left: 1rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-navbar);
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
    transform: scale(1.1);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

/* Layout Containers */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
}

.card,
.form-container,
.table-container,
.login-box,
.plans-list {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px var(--shadow-color);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-6);
    padding: var(--space-6);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    background: var(--bg-card);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.page-header h1 {
    font-size: 2rem;
    margin: 0;
}

.page-header div {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--bg-card);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px var(--shadow-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px var(--shadow-color);
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

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

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

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

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}

.table thead {
    background: var(--bg-hover);
    border-bottom: 2px solid var(--border-color);
}

.table th {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.table td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

/* Forms */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-3);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-inverse);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px var(--shadow-color);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

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

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

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

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-info {
    background: var(--info);
    color: #ffffff;
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--bg-primary-light);
    color: var(--text-primary-dark);
}

.badge-success {
    background: var(--bg-success-light);
    color: var(--text-success-dark);
}

.badge-warning {
    background: var(--bg-warning-light);
    color: var(--text-warning-dark);
}

.badge-danger {
    background: var(--bg-danger-light);
    color: var(--text-danger-dark);
}

.badge-info {
    background: var(--bg-info-light);
    color: var(--text-info-dark);
}

/* Alerts */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-success {
    background: var(--bg-success-light);
    color: var(--text-success-dark);
    border-color: var(--bg-success-light);
}

.alert-error {
    background: var(--bg-danger-light);
    color: var(--text-danger-dark);
    border-color: var(--bg-danger-light);
}

.alert-warning {
    background: var(--bg-warning-light);
    color: var(--text-warning-dark);
    border-color: var(--bg-warning-light);
}

.alert-info {
    background: var(--bg-info-light);
    color: var(--text-info-dark);
    border-color: var(--bg-info-light);
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: var(--space-4);
}

[data-theme="dark"] .login-page {
    background: var(--bg-body);
}

.login-box {
    width: 100%;
    max-width: 450px;
    padding: 0;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: #ffffff;
    padding: var(--space-10) var(--space-8);
    text-align: center;
}

.login-header h1 {
    color: #ffffff;
    margin-bottom: var(--space-2);
}

.login-header p {
    color: rgba(255, 255, 255, 0.9);
}

.login-form {
    padding: var(--space-8);
}

.login-footer {
    padding: var(--space-4) var(--space-8);
    background: var(--bg-hover);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted) !important;
}

code {
    background: var(--bg-hover);
    color: var(--primary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
}

/* Mobile Responsive */
.hamburger {
    display: none;
}

@media (max-width: 768px) {
    .navbar {
        padding: var(--space-3) var(--space-4);
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
        padding: 8px;
        background: none;
        border: none;
        z-index: 101;
    }

    .hamburger span {
        width: 24px;
        height: 2px;
        background: var(--text-navbar);
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    .navbar-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-card);
        box-shadow: -2px 0 10px var(--shadow-color);
        flex-direction: column;
        padding: var(--space-8) var(--space-4);
        gap: var(--space-2);
        transition: right 0.3s ease;
        overflow-y: auto;
        z-index: 100;
        align-items: flex-start;
    }

    .navbar-menu.active {
        right: 0;
    }

    .navbar-menu a {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        border-radius: var(--radius-md);
    }

    .navbar-menu a:hover {
        background: var(--bg-hover);
    }

    .menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        backdrop-filter: blur(2px);
    }

    .menu-overlay.active {
        display: block;
    }

    /* Responsive Layout Adjustments */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .page-header div {
        width: 100%;
        flex-direction: column;
    }

    .page-header .btn {
        width: 100%;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Enhanced Search Bar */
.search-bar {
    margin-bottom: var(--space-8);
}

.search-bar form {
    display: flex;
    gap: var(--space-2);
    background: var(--bg-card);
    padding: var(--space-2);
    border-radius: 100px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    align-items: center;
    transition: var(--transition);
    max-width: 800px;
    margin: 0 auto;
}

.search-bar form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px var(--shadow-color);
    transform: translateY(-2px);
}

.search-bar input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: var(--space-3) var(--space-6);
    font-size: 1.05rem;
    color: var(--text-primary);
    border-radius: 100px;
    box-shadow: none !important;
}

.search-bar input:focus {
    outline: none;
}

.search-bar .btn {
    border-radius: 100px;
    padding: var(--space-3) var(--space-8);
    margin: 2px;
}

/* Mobile adjustments for search bar */
@media (max-width: 768px) {
    .search-bar form {
        flex-direction: column;
        border-radius: var(--radius-xl);
        padding: var(--space-4);
        gap: var(--space-3);
    }

    .search-bar input {
        width: 100%;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-md);
        padding: var(--space-3);
        background: var(--bg-input) !important;
    }

    .search-bar .btn {
        width: 100%;
        border-radius: var(--radius-md);
    }
}

/* ============================================
   MOBILE OPTIMIZATIONS & FIXES
   ============================================ */

/* 1. Stats Grid - 2 Columns on Mobile */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-3);
    }

    .stat-card {
        padding: var(--space-4);
        flex-direction: column;
        text-align: center;
        gap: var(--space-2);
    }

    .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }
}

/* 2. Responsive Tables - Hide columns on mobile */
@media (max-width: 768px) {

    /* Hide less important columns on mobile */
    .table th:nth-child(3),
    /* Email/Info */
    .table td:nth-child(3),
    .table th:nth-child(4),
    /* Credits/Other */
    .table td:nth-child(4) {
        display: none;
    }

    /* Ensure container scrolls if still too wide */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust remaining columns */
    .table th,
    .table td {
        padding: var(--space-3) var(--space-2);
        font-size: 0.85rem;
    }

    /* Actions column adjustment */
    .actions {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .actions .btn {
        padding: 0.25rem 0.5rem;
    }
}

/* 3. Reports Table - Horizontal Scroll */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-xl);
}

/* 4. Settings Cards Fix for Dark Mode */
[data-theme="dark"] .card h2,
[data-theme="dark"] .card h3,
[data-theme="dark"] .card p,
[data-theme="dark"] .card div {
    color: var(--text-primary);
}

[data-theme="dark"] .card small {
    color: var(--text-secondary);
}

/* Specific fix for the info cards in settings.php if they use inline styles */
[data-theme="dark"] div[style*="background: white"],
[data-theme="dark"] div[style*="background-color: white"] {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] div[style*="color: #6b7280"] {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] div[style*="color: #4f46e5"],
[data-theme="dark"] div[style*="color: #10b981"],
[data-theme="dark"] div[style*="color: #374151"] {
    color: var(--text-primary) !important;
}

/* Info Grid & Items */
.info-grid {
    display: grid;
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

/* ============================================
   PLANS PAGE LAYOUT
   ============================================ */

.plans-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.plan-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.plan-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px var(--shadow-color);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-3);
}

.plan-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary);
}

.plan-price {
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.plan-details {
    margin-bottom: var(--space-4);
    flex-grow: 1;
}

.plan-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    margin-top: auto;
}

/* Desktop Layout for Plans */
@media (min-width: 768px) {
    .plans-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: var(--space-6);
    }
}

/* Ensure at least 2 columns on larger screens as requested */
@media (min-width: 1024px) {
    .plans-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* If there are many plans, allow 3 */
@media (min-width: 1280px) {
    .plans-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   PAYMENT HISTORY STYLES
   ============================================ */
.payment-history-container {
    background-color: var(--bg-body) !important;
    padding: 20px;
    border-radius: var(--radius-md);
}

.payment-history-table tr {
    background-color: var(--bg-card) !important;
}

.payment-history-table tr.total-row {
    background-color: var(--bg-hover) !important;
}

.payment-history-table th {
    background-color: var(--bg-card) !important;
    color: var(--text-primary);
}

.payment-history-table td {
    color: var(--text-primary);
}

/* ============================================
   COMPACT TABLE STYLES
   ============================================ */
.table-compact th,
.table-compact td {
    padding: 6px 8px;
    font-size: 0.85rem;
}

.table-compact .badge {
    padding: 2px 6px;
    font-size: 0.75rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 1.1rem;
    line-height: 1;
}

.text-nowrap {
    white-space: nowrap;
}

/* Ensure actions column doesn't wrap weirdly */
.table-compact .actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-start;
}


/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

/* Prevent iOS Zoom on inputs */
@media screen and (max-width: 768px) {

    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Improve touch targets */
    .btn,
    .btn-sm,
    .btn-xs,
    .page-link {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-xs {
        min-height: 32px;
        /* Slightly smaller for table actions but still clickable */
        min-width: 32px;
    }

    /* Better spacing for stacked cards */
    .card {
        padding: var(--space-4);
    }

    /* Full width buttons on mobile forms */
    .form-actions .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .form-actions {
        flex-direction: column;
    }
}

/* Scroll to Top Button */
#scrollTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--primary);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    font-size: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
    width: 50px;
    height: 50px;
    align-items: center;
    justify-content: center;
}

#scrollTopBtn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
}

/* Mobile Menu Enhancements */
@media screen and (max-width: 768px) {
    .navbar-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        /* Not full width to see background */
        max-width: 300px;
        height: 100vh;
        background: var(--bg-card);
        flex-direction: column;
        padding: 80px 20px 20px;
        transition: 0.3s ease-in-out;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
        align-items: flex-start;
        overflow-y: auto;
    }

    .navbar-menu.active {
        right: 0;
    }

    .navbar-menu a {
        width: 100%;
        padding: 15px;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
        font-size: 1.1rem;
    }

    .navbar-menu .theme-switch {
        margin: 20px 0 0 15px;
    }

    /* Overlay for menu */
    .menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        backdrop-filter: blur(2px);
    }

    .menu-overlay.active {
        display: block;
    }
}

/* ============================================
   THEME SWITCH STYLES
   ============================================ */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    margin-left: 15px;
}

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

.theme-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

.theme-switch .slider.round {
    border-radius: 34px;
}

.theme-switch .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}

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

.theme-switch input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

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

.icon-sun,
.icon-moon {
    font-size: 14px;
    z-index: 1;
    user-select: none;
}

.icon-sun {
    margin-left: 2px;
}

.icon-moon {
    margin-right: 2px;
}

/* Generic Switch Styles (for Settings) */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

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

.switch input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

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

.switch .slider.round {
    border-radius: 34px;
}

.switch .slider.round:before {
    border-radius: 50%;
}