/* =========================================
   Glassmorphism Dark UI - Gym Management System
   ========================================= */

/* --- Variables & Theme Configuration --- */
:root {
    /* Color Palette - Dark Premium */
    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --primary-glow: rgba(99, 102, 241, 0.4);

    --accent: #06b6d4;
    /* Cyan 500 */
    --accent-hover: #0891b2;

    --success: #10b981;
    /* Emerald 500 */
    --success-bg: rgba(16, 185, 129, 0.2);

    --warning: #f59e0b;
    /* Amber 500 */
    --warning-bg: rgba(245, 158, 11, 0.2);

    --danger: #ef4444;
    /* Red 500 */
    --danger-bg: rgba(239, 68, 68, 0.2);

    /* Backgrounds & Surfaces */
    --bg-dark: #0f172a;
    /* Slate 900 */
    --bg-darker: #020617;
    /* Slate 950 */

    /* Glassmorphism Layers */
    --glass-surface: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);

    /* Typography */
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --text-muted: #64748b;
    /* Slate 500 */

    /* Spacing & Layout */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --header-height: 70px;
    --sidebar-width: 260px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    /* Dynamic Ambient Background */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.08), transparent 25%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Layout Structure --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.6);
    /* Semi-transparent Navigation */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

/* --- Animated Logo --- */
.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    position: relative;
    padding: 5px 0;
}

.logo-icon-wrapper {
    position: relative;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--primary-glow);
    animation: floatIcon 3s ease-in-out infinite;
}

.logo-icon-main {
    color: #fff;
    font-size: 1.5rem;
    transform: rotate(-15deg);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo-pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: pulseRing 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.logo-text-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1;
}

.logo-text-energy {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #fff 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

.logo-text-fitness {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 3px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-left: 2px;
}

/* Animations */
@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseRing {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.6);
        opacity: 0;
    }
}

/* RTL Support for Logo */
html[dir='rtl'] .logo-icon-main {
    transform: rotate(15deg);
    /* Flip icon rotation */
}

html[dir='rtl'] .logo-text-wrapper {
    align-items: flex-end;
    /* Align text to right */
}

html[dir='rtl'] .logo-text-fitness {
    margin-left: 0;
    margin-right: 2px;
}

.nav-menu {
    list-style: none;
    padding: 1.5rem 1rem;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link i {
    width: 20px;
    text-align: center;
    transition: color 0.2s ease;
}

.nav-link:hover {
    background: var(--glass-highlight);
    color: #fff;
}

.nav-link:hover i {
    color: var(--primary);
}

.nav-item.active .nav-link {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), transparent);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    border-radius: 4px var(--radius-md) var(--radius-md) 4px;
    /* Simpler borders */
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--glass-highlight);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 0 10px var(--primary-glow);
}

.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

/* --- Cards & Glass Components --- */
.card,
.stat-card {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    position: relative;
}

/* Shine effect on hover */
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
    background-size: 200% 100%;
    background-position: 100% 0;
    transition: background-position 0.6s;
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-card:hover::after {
    background-position: -100% 0;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

.stat-trend {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

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

.stat-trend.neutral {
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: var(--font-main);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

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

.btn-success:hover {
    background: #059669;
}

/* --- Forms & Inputs --- */
/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
    /* For icon positioning if needed */
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    /* Semic-bold for better readability */
    letter-spacing: 0.3px;
}

.form-control,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25) !important;
    /* Deep glass background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Subtle border */
    border-radius: var(--radius-md);
    color: #fff !important;
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    /* Slight blur for premium feel */
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    /* Soft glow */
    background: rgba(0, 0, 0, 0.4) !important;
    /* Darker on focus */
}

/* Custom Select Arrow for all selects */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 40px;
    /* Space for arrow */
}

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Section Header Styles inside Tabs */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title h3 {
    color: #fff;
    font-size: 1.25rem;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-expired {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
        background: rgba(15, 23, 42, 0.95);
        /* More opaque for readability */
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        /* 1 column on mobile/tablet */
    }

    /* Mobile Table Card View */
    @media (max-width: 768px) {

        table,
        thead,
        tbody,
        th,
        td,
        tr {
            display: block;
        }

        thead {
            display: none;
        }

        tr {
            background: var(--glass-highlight);
            border-radius: var(--radius-md);
            margin-bottom: 1rem;
            padding: 1rem;
            border: 1px solid var(--glass-border);
        }

        td {
            padding: 0.5rem 0;
            border: none;
            display: flex;
            justify-content: space-between;
            align-items: center;
            text-align: right;
        }

        td::before {
            content: attr(data-label);
            font-weight: 600;
            color: var(--text-secondary);
            margin-right: 1rem;
            text-align: left;
        }
    }
}

/* Helpers */
.text-success {
    color: var(--success) !important;
}

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

.hidden {
    display: none !important;
}

/* --- Search Filters (Members Page) --- */
.filters {
    background: var(--glass-surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}


.filter-group input,
.filter-group select {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font-main);
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

/* Global Readonly/Disabled Input Styles */
input[readonly],
input:disabled,
select:disabled {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: transparent !important;
    cursor: not-allowed;
    color: var(--text-muted) !important;
    pointer-events: none;
    /* Prevent clicks/focus */
}

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

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: rgba(0, 0, 0, 0.4) !important;
}

/* --- Modals (Glassmorphism) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}




.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

/* Modal Specifics */
.member-details h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.member-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.transaction-amount {
    font-weight: 700;
    color: var(--success);
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* =========================================
   ROBUST GLOBAL RESET & PRESETS
   ========================================= */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    background-color: #0f172a !important;
    /* Fallback */
    background: var(--bg-dark) !important;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.08), transparent 25%) !important;
    color: #f8fafc !important;
}

/* Ensure glass variables penetrate shadow DOM or scoped styles */
:root {
    --glass-surface: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* =========================================
   UI FIXES - Profile & Cards
   ========================================= */

/* --- Profile Dropdown --- */
.user-profile-container {
    position: relative;
    margin-left: 1.5rem;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    padding: 6px 16px 6px 6px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.user-profile-trigger:hover,
.user-profile-dropdown.active .user-profile-trigger {
    background: var(--glass-highlight);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-avatar .avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 0 10px var(--primary-glow);
}

.user-info-compact {
    text-align: left;
    margin-right: 8px;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.user-profile-dropdown {
    position: relative;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--bg-dark);
    /* Solid background for legibility */
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.user-profile-dropdown.active .user-dropdown-menu,
.user-dropdown-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0);
    z-index: 10000;
    display: block !important;
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--glass-highlight);
    color: #fff;
}

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

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

.logout-item:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* --- Member & Subscription Lists (Grid View) --- */
.members-list,
.subscriptions-grid,
.trainers-list,
.staff-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding-top: 1rem;
}

.member-card,
.subscription-card,
.staff-card,
.trainer-card {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.member-card:hover,
.subscription-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-md);
}

.member-info h4,
.subscription-card h3 {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.member-info p,
.subscription-duration {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.subscription-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.member-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.member-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.member-status.expired {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.member-actions,
.subscription-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.member-actions .btn,
.subscription-actions .btn {
    flex: 1;
    font-size: 0.85rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    background: var(--glass-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* --- Fix for Reports Section Layout --- */
#reports {
    overflow-x: hidden;
}

/* Report Filters Layout - RESTORED & CLEANED */
.tab-filters {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-left: auto;
    /* Push buttons to the right */
}

/* Quick Filters Row */
.quick-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

.filter-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

/* Export Actions alignment */
.export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

/* Revenue Summary Cards Fix */
.revenue-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.revenue-item {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.revenue-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
}

.revenue-content h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.revenue-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.revenue-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.total-revenue .revenue-amount {
    color: var(--success);
}

.total-revenue .revenue-icon {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

/* --- Language Selector (Sidebar) --- */
.language-selector {
    width: 100%;
    margin-top: auto;
    /* Push to bottom if needed, though sidebar-footer handles this */
}

.language-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    gap: 4px;
    backdrop-filter: blur(5px);
}

.lang-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: var(--font-main);
}

.lang-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* --- Modal Close Button Styling (Final) --- */
.close-modal {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    padding: 0;
    z-index: 10;
}

.close-modal:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    transform: rotate(90deg);
}

/* --- Header Profile Refinement --- */
.user-profile-trigger {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    padding: 6px 12px 6px 6px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
}

.user-profile-trigger:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dropdown-arrow {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.user-profile-trigger[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* --- Header Layout Fix --- */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0 2rem 0;
    margin-bottom: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: none;
}

@media (max-width: 1024px) {
    .menu-toggle {}
}

/* =========================================
   FORCED PREMIUM STYLES (Specificity Fix)
   ========================================= */

/* Target IDs specifically to handle missing classes */
#memberName,
#memberPhone,
#memberEmail,
#memberStartDate,
#memberSubscription,
#memberTrainer,
#subscriptionName,
#subscriptionDuration,
#subscriptionDurationType,
#subscriptionPrice,
#staffName,
#staffPhone,
#staffEmail,
#staffRole,
#staffUsername,
#staffPassword,
#walkingCustomerAmount,
#walkingCustomerNotes,
#trainerName,
#trainerPhone,
#trainerEmail,
#trainerSpecialization,
#trainerBio,
.form-control,
.form-select,
.filter-group input,
.filter-group select {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    backdrop-filter: blur(5px) !important;
    border-radius: var(--radius-md) !important;
    padding: 12px 16px !important;
    font-family: var(--font-main) !important;
    box-shadow: none !important;
    width: 100% !important;
    /* Ensure full width */
    display: block !important;
}

#memberName:focus,
#memberPhone:focus,
#memberEmail:focus,
#memberStartDate:focus,
#memberSubscription:focus,
#memberTrainer:focus,
#subscriptionName:focus,
#subscriptionDuration:focus,
#subscriptionDurationType:focus,
#subscriptionPrice:focus,
#staffName:focus,
#staffPhone:focus,
#staffEmail:focus,
#staffRole:focus,
#staffUsername:focus,
#staffPassword:focus,
#walkingCustomerAmount:focus,
#walkingCustomerNotes:focus,
#trainerName:focus,
#trainerPhone:focus,
#trainerEmail:focus,
#trainerSpecialization:focus,
#trainerBio:focus,
.form-control:focus,
.form-select:focus {
    background: rgba(0, 0, 0, 0.5) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    outline: none !important;
}

/* Fix Labels */
#memberForm label,
#subscriptionForm label,
#staffForm label,
#walkingCustomerForm label,
#trainerForm label,
.form-label {
    display: block !important;
    margin-bottom: 0.5rem !important;
    color: var(--text-secondary) !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
}

/* Modal Content Background */
.modal-content {
    background: rgba(30, 41, 59, 0.9) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    position: relative !important;
}

/* Target BOTH .close-modal AND .close-btn */
.close-modal,
.close-btn,
#closeSubscriptionModal,
#closeStaffModal,
#closeWalkingCustomerModal,
#closeTrainerModal {
    position: absolute !important;
    top: 1.5rem !important;
    right: 1.5rem !important;
    width: 36px !important;
    height: 36px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    z-index: 100 !important;
    transition: all 0.3s ease !important;
}

.close-modal:hover,
.close-btn:hover,
#closeSubscriptionModal:hover,
#closeStaffModal:hover,
#closeWalkingCustomerModal:hover,
#closeTrainerModal:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    transform: rotate(90deg) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

/* Sticky Footer Logic */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    /* Pushes footer down */
    display: flex;
    flex-direction: column;
}

.app-footer {
    margin-top: auto;
    /* Ensures it stays at bottom if content is short */
    background: rgba(30, 41, 59, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
    text-align: center;
    width: 100%;
    z-index: 10;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.company-link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.company-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* =========================================
   PREMIUM REPORTS DASHBOARD
   ========================================= */

/* 1. Report Tabs (Organic Glass) */
.report-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.15);
    /* Primary tint */
    border: 1px solid var(--primary);
    color: #fff;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.tab-btn.active i {
    transform: scale(1.1);
    color: var(--primary);
}

/* 2. Stats Grid (Premium Cards) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Variant Colors for Icons */
.stat-card.members .stat-icon-wrapper {
    color: var(--accent);
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
}

.stat-card.revenue .stat-icon-wrapper {
    color: var(--success);
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.stat-card.walking .stat-icon-wrapper {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
}

.stat-card.new .stat-icon-wrapper {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
}

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

/* 3. Charts Section */
.charts-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Revenue wider than donut */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    height: 400px;
}

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

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

    .chart-container {
        height: 350px;
    }
}

/* Custom Select Arrow for IDs */
#memberSubscription,
#memberTrainer,
#subscriptionDurationType,
#staffRole,
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    padding-right: 40px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* =========================================
   PAGINATION CONTROLS
   ========================================= */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    margin-top: 1rem;
}

.pagination-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.pagination-controls button:hover:not(:disabled) {
    background: rgba(79, 70, 229, 0.2);
    /* Primary tint */
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
    border-color: transparent;
}

.page-info {
    font-family: var(--font-main);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 150px;
    text-align: center;
}

.page-info span {
    color: var(--text-primary);
    font-weight: 600;
}

/* =========================================
   SYSTEM SETTINGS & PROFILE STYLES (ADDED)
   ========================================= */

/* 1. Missing Input Styles for Profile & Settings */
#profileForm input,
#smtpConfigurationForm input,
#generalSettingsForm input,
#whatsappConfigurationForm input,
#profileName,
#profileUsername,
#profileEmail,
#profileCurrentPassword,
#profileNewPassword,
#profileConfirmPassword,
#emailSmtpHost,
#emailSmtpPort,
#emailSmtpUsername,
#emailSmtpPassword,
#emailFromAddress,
#emailRecipients,
#systemGymName,
#whatsappApiKey,
#whatsappPhoneNumber {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    backdrop-filter: blur(5px) !important;
    border-radius: var(--radius-md) !important;
    padding: 12px 16px !important;
    font-family: var(--font-main) !important;
    width: 100% !important;
    display: block !important;
}

#profileForm input:focus,
#smtpConfigurationForm input:focus,
.settings-form input:focus {
    background: rgba(0, 0, 0, 0.5) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    outline: none !important;
}

/* 2. System Settings Navigation */
.settings-navigation {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow-x: auto;
}

.settings-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.settings-nav-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.settings-nav-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--primary);
    color: #fff;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

/* 3. Settings Sections & Cards */
.settings-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-content.active {
    display: block;
}

.settings-section {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.settings-section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.settings-section-header h3 {
    font-size: 1.25rem;
    color: #fff;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-section-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 4. Settings Forms Layout */
.settings-form .form-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-form .form-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-form .form-col-full {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-form label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* 5. Info Cards Grid */
.system-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.info-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.info-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

/* 6. Report Tables */
.report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

.report-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--glass-border);
}

.report-table td {
    padding: 1rem;
    color: #fff;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.95rem;
    vertical-align: middle;
}

.report-table tr:last-child td {
    border-bottom: none;
}

.report-table tbody tr {
    transition: background 0.2s ease;
}

.report-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.report-table-container {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* 7. Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-input {
    display: none;
}

.toggle-label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 1rem;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 34px;
    transition: 0.4s;
    border: 1px solid var(--glass-border);
}

.toggle-slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: 0.4s;
}

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

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

.toggle-text {
    color: #fff;
    font-weight: 500;
}


/* =========================================
   RTL SUPPORT (RIGHT-TO-LEFT)
   ========================================= */

/* Base RTL Rules */
html[dir='rtl'] {
    direction: rtl;
    text-align: right;
}

html[dir='rtl'] body {
    text-align: right;
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    /* Arabic friendly font */
}

/* Layout Mirroring */
/* Layout Mirroring */
html[dir='rtl'] .app-container {
    flex-direction: row;
    /* Keep row, but sidebar moves to right via positioning */
}

html[dir='rtl'] .sidebar {
    right: 0;
    left: auto;
    border-right: none;
    border-left: 1px solid var(--glass-border);
}

html[dir='rtl'] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

html[dir='rtl'] .logo {
    flex-direction: row-reverse;
}

html[dir='rtl'] .logo i {
    margin-right: 0;
    margin-left: 0.75rem;
}

/* Navigation & Menu */
html[dir='rtl'] .nav-link {
    text-align: right;
    flex-direction: row;
    /* Ensure flex flow isn't reversed, we want Icon - Text (Right to Left) */
}

html[dir='rtl'] .nav-item.active .nav-link {
    border-left: none;
    border-right: 3px solid var(--primary);
    border-radius: var(--radius-md) 4px 4px var(--radius-md);
    background: linear-gradient(270deg, rgba(99, 102, 241, 0.15), transparent);
    /* Flip gradient */
}

html[dir='rtl'] .nav-link i {
    margin-right: 0;
    margin-left: 1rem;
}

html[dir='rtl'] .nav-link .fa-chevron-right {
    margin-left: 0;
    margin-right: auto;
    transform: rotate(180deg);
}

/* Header & Profile */
html[dir='rtl'] .header-left,
html[dir='rtl'] .header-right {
    flex-direction: row;
}

html[dir='rtl'] .user-profile-trigger {
    padding: 6px 6px 6px 12px;
    flex-direction: row;
}

html[dir='rtl'] .user-profile-trigger .avatar-circle {
    margin-right: 0;
    margin-left: 10px;
}

html[dir='rtl'] .user-dropdown-menu {
    right: auto;
    left: 0;
    text-align: right;
}

html[dir='rtl'] .dropdown-item i {
    margin-right: 0;
    margin-left: 10px;
}

/* Cards & Dashboard */
html[dir='rtl'] .stat-card {
    text-align: right;
}

html[dir='rtl'] .stat-icon-wrapper {
    margin-right: 0;
    margin-left: auto;
    /* Moves icon to left in RTL if flex-column? No, usually icons stay. */
    /* If flex-row */
    margin-left: 1rem;
}

html[dir='rtl'] .settings-section-header h3 {
    flex-direction: row;
}

html[dir='rtl'] .settings-section-header h3 i {
    margin-right: 0;
    margin-left: 0.75rem;
}

/* Forms & Inputs */
html[dir='rtl'] .form-row {
    flex-direction: row;
}

html[dir='rtl'] .input-group,
html[dir='rtl'] .password-input-group {
    flex-direction: row;
}

html[dir='rtl'] .input-group input,
html[dir='rtl'] .password-input-group input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
    border-left: none !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html[dir='rtl'] .input-group .btn,
html[dir='rtl'] .password-input-group .btn,
html[dir='rtl'] .input-addon {
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
    border-right: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html[dir='rtl'] .form-select {
    background-position: left 1rem center !important;
    padding-right: 16px !important;
    padding-left: 40px !important;
}

html[dir='rtl'] .toggle-switch {
    flex-direction: row;
}

html[dir='rtl'] .toggle-label {
    flex-direction: row;
}

html[dir='rtl'] .toggle-slider:before {
    left: auto;
    right: 4px;
}

html[dir='rtl'] .toggle-input:checked+.toggle-label .toggle-slider:before {
    transform: translateX(-24px);
}

/* Tables & Lists */
html[dir='rtl'] .report-table th,
html[dir='rtl'] .report-table td {
    text-align: right;
}

html[dir='rtl'] .table-header {
    flex-direction: row;
}

html[dir='rtl'] .filter-section {
    flex-direction: row;
}

html[dir='rtl'] .search-box i {
    left: auto;
    right: 1rem;
}

html[dir='rtl'] .search-box input {
    padding-left: 1rem;
    padding-right: 2.5rem;
}

/* Pagination */
html[dir='rtl'] .pagination-controls {
    flex-direction: row;
}

html[dir='rtl'] .pagination-controls button i {
    transform: rotate(180deg);
    /* Flip chevron arrows */
}

/* Modals */
html[dir='rtl'] .modal-header {
    flex-direction: row;
}

html[dir='rtl'] .close-modal,
html[dir='rtl'] .close-btn {
    right: auto;
    left: 1.5rem;
}

/* Info Cards */
html[dir='rtl'] .info-card {
    flex-direction: row;
}

html[dir='rtl'] .info-icon {
    margin-right: 0;
    margin-left: 1rem;
}

/* Settings Tabs */
html[dir='rtl'] .settings-navigation {
    flex-direction: row;
}

html[dir='rtl'] .settings-nav-btn {
    flex-direction: row;
}

html[dir='rtl'] .settings-nav-btn i {
    margin-right: 0;
    margin-left: 0.75rem;
}

/* Utils */
html[dir='rtl'] .mr-2 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

html[dir='rtl'] .ml-2 {
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
}

html[dir='rtl'] .pr-4 {
    padding-right: 0 !important;
    padding-left: 1rem !important;
}

html[dir='rtl'] .pl-4 {
    padding-left: 0 !important;
    padding-right: 1rem !important;
}

/* --- Fix: Report Tab Switching --- */
.report-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.report-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   SYSTEM SETTINGS & PREMIUM FORMS
   ========================================= */

/* Settings Section Card */
.settings-section {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-section:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Form Styles */
.settings-form .form-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 250px;
}

.form-col-full {
    width: 100%;
}

.form-input,
.template-editor {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid var(--glass-border) !important;
    color: #fff !important;
    border-radius: var(--radius-md) !important;
    padding: 0.75rem 1rem !important;
    font-family: var(--font-main) !important;
    transition: all 0.3s ease !important;
    width: 100%;
}

.form-input:focus,
.template-editor:focus {
    background: rgba(0, 0, 0, 0.5) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    outline: none !important;
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Template Editor */
.template-editor-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    margin-top: 1rem;
}

.editor-toolbar {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.editor-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-toolbar button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.template-editor {
    width: 100%;
    min-height: 300px;
    resize: vertical;
    border: none !important;
    border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
    background: transparent !important;
}

/* Responsive Fixes specifically for System Forms */
@media (max-width: 768px) {
    .settings-form .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .form-col {
        min-width: 100%;
    }
}