:root {
    /* Light Mode (Default) - Green Theme */
    --primary: #8CC63F;
    --primary-hover: #7ab335;
    --header-bg: var(--primary); 
    --header-text: #ffffff;
    
    --bg-color: #F5F5F7;
    --card-bg: #ffffff;
    --text-main: #1d1d1f;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --border-focus: #8CC63F;
    --input-bg: #ffffff;
    
    --flash-bg: #fef3c7;
    --flash-text: #b45309;
    --flash-border: #f59e0b;
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    /* Dark Mode */
    --primary: #8CC63F;
    --primary-hover: #7ab335;
    --header-bg: var(--primary); 
    --header-text: #ffffff;
    
    --bg-color: #121212;
    --card-bg: #1c1c1c;
    --text-main: #ededed;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --border-focus: #8CC63F;
    --input-bg: #2a2a2a;
    
    --flash-bg: rgba(253, 230, 138, 0.1);
    --flash-text: #fcd34d;
    --flash-border: #d97706;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.5;
}

header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.header-main {
    display: flex;
    align-items: center;
}

.header-main .logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--header-text);
}

.header-main .logo .brand-logo-icon {
    width: 16px;
    height: 16px;
    background-color: var(--header-text); /* White icon on green background */
    border-radius: 4px;
    transform: rotate(45deg);
    margin-right: 10px;
}

.header-main .logo .logo-text {
    color: var(--header-text);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    margin-left: auto;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: var(--header-text);
    margin: 3px 0;
    transition: 0.4s;
    border-radius: 2px;
}

header a {
    color: var(--header-text);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: opacity 0.2s;
}

header a:hover {
    opacity: 0.8;
}

.member-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    margin-left: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.member-level-badge.monthly {
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
}

.member-level-badge.yearly {
    background: linear-gradient(135deg, #6c5ce7, #00b894);
}

main {
    flex: 1;
    padding: 2.5rem 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

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

main a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.flash-messages {
    margin-bottom: 1.5rem;
}

.flash-message {
    background-color: var(--flash-bg);
    color: var(--flash-text);
    padding: 1rem 1.25rem;
    border: 1px solid var(--flash-border);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

h1, h2, h3 {
    margin-top: 0;
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.025em;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="file"],
input[type="tel"],
input[type="number"],
select,
textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: var(--input-bg);
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(161, 0, 255, 0.15);
}

input[type="submit"], button, .btn, .button {
    background-color: var(--primary);
    color: white;
    border: 1px solid transparent;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

input[type="submit"]:hover, button:hover, .btn:hover, .button:hover {
    background-color: var(--primary-hover);
}

.search-form button,
.search-form input[type="submit"],
.search-form a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    white-space: nowrap;
}

.search-form .search-clear {
    background-color: #4b5563;
}

.search-form .search-clear:hover {
    background-color: #374151;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.5rem;
}

th, td {
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

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

/* Toggle Switch CSS (Supabase style) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}
input:checked + .slider {
    background-color: var(--primary);
}
input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(161, 0, 255, 0.15);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }
    .header-main {
        width: 100%;
        justify-content: space-between;
    }
    .menu-toggle {
        display: flex;
    }
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
        align-items: center;
    }
    .nav-menu.active {
        display: flex;
    }
    .nav-menu a {
        margin: 0.25rem 0;
        padding: 0.75rem;
        width: 100%;
        text-align: center;
        background-color: rgba(255,255,255,0.05);
        border-radius: var(--radius-sm);
        box-sizing: border-box;
    }
    .nav-menu span {
        display: block;
        margin: 0.5rem 0;
        text-align: center;
        font-size: 0.95rem;
    }

    .member-level-badge {
        margin-left: 0;
        margin-top: 0.25rem;
    }
    
    /* Hamburger Animation */
    .menu-toggle.active .bar:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    main {
        padding: 1.5rem 1rem;
    }
    .card {
        padding: 1.5rem;
    }
    
    /* Hide table headers on mobile */
    .mobile-table thead {
        display: none;
    }
    .mobile-table tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 1rem;
        background: var(--card-bg);
        box-shadow: var(--shadow-sm);
    }
    .mobile-table td {
        border: none;
        padding: 0.5rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Utility classes */
    .mobile-hidden {
        display: none !important;
    }
    .desktop-hidden {
        display: block !important;
    }
}

.desktop-hidden {
    display: none;
}

/* Global Loader Styles */
.global-loader {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.global-loader.active {
    opacity: 1;
    visibility: visible;
}

.loader-content {
    background: var(--card-bg);
    padding: 2rem 3rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loader-spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.loader-text {
    color: var(--text-main);
    font-weight: 500;
    font-size: 1.05rem;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
