@import url('https://fonts.googleapis.com/css2?family=Outlet:wght@300;400;500;600;700&display=swap');

/* --- GLOBAL VARIABLES --- */
:root {
    /* Color Palette - Dark Premium Theme */
    --bg-main: #0f172a;
    /* Deep Slate blue */
    --bg-surface: #1e293b;
    /* Lighter Slate */
    --primary-color: #3b82f6;
    /* Vibrant Blue */
    --primary-hover: #2563eb;
    --secondary-color: #8b5cf6;
    /* Purple */
    --accent-color: #10b981;
    /* Emerald Green for success */
    --danger-color: #ef4444;
    /* Red for alert/danger */
    --warning-color: #f59e0b;
    /* Amber */

    /* Text Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Glassmorphism Variables */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* Borders & Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* --- RESETS & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.dark-theme {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
}

/* --- TYPOGRAPHY & UTILITIES --- */
h1,
h2,
h3,
h4,
h5 {
    font-weight: 600;
}

.text-primary {
    color: var(--primary-color);
}

.text-success {
    color: var(--accent-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-muted {
    color: var(--text-muted);
}

/* --- LAYOUT STRUCTURE --- */
.app-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    z-index: 100;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .status-card,
.sidebar.collapsed .page-title {
    display: none;
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.logo-text {
    font-size: 1.5rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.nav-item {
    padding: 0.2rem 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: var(--transition-normal);
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, var(--primary-color) 0%, rgba(59, 130, 246, 0.3) 100%);
    border-left: 3px solid var(--primary-light);
}

.nav-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
}

.status-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.status-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.status-value {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Main Wrapper & Header */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Glass Header */
.glass-header {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.top-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 10;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.menu-toggle {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.menu-toggle:hover {
    color: var(--text-main);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 500;
}

.icon-btn {
    position: relative;
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-main);
}

.badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: var(--radius-full);
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    max-width: 60vw;
    /* Prevent overflow on small screens */
}

.user-dropdown:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
    /* Subtle background grid pattern for premium feel */
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 40px 40px;
}

/* Loader */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- GLASSMORPHISM COMPONENTS --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.icon-blue {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.icon-green {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.icon-purple {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.icon-orange {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.stat-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Lists & Tables */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
}

.custom-table th,
.custom-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-table th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active,
.status-paid {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.status-closed,
.status-unpaid {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition-fast);
    background: transparent;
}

.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-icon.text-danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    outline: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.glass-modal {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(20px);
    transition: var(--transition-normal);
}

.modal-overlay.active .glass-modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.2rem;
}

.close-modal {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grid Views (Cards) for pools */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        height: 100%;
        transform: translateX(-100%);
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Mobile overlay for sidebar */
    .sidebar-mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-mobile-overlay.active {
        display: block;
    }

    .top-header {
        padding: 0 1rem;
    }

    .user-name {
        font-size: 0.8rem;
    }

    .page-title {
        font-size: 1.1rem;
    }
}

/* --- Settings Tabs UI --- */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 5px;
}

.settings-tabs::-webkit-scrollbar {
    height: 4px;
}

.settings-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.settings-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.setting-tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-normal);
    white-space: nowrap;
}

.setting-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.setting-tab-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.setting-tab-content {
    display: none;
    animation: fadeIn 0.3s ease forwards;
}

.setting-tab-content.active {
    display: block;
}