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

:root {
    --bg-color: #f3f6fc;
    --sidebar-bg: rgba(255, 255, 255, 0.7);
    --panel-bg: rgba(255, 255, 255, 0.9);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent: #1a365d;
    --accent-hover: #1e40af;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border: rgba(226, 232, 240, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --radius: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    /* Soft mesh gradient background for a premium feel */
    background-image: 
        radial-gradient(at 40% 20%, hsla(228,100%,74%,0.1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189,100%,56%,0.1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355,100%,93%,0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }

a { text-decoration: none; color: inherit; }

/* Layout Shell */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    padding: 0 16px 32px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--accent);
    transform: translateX(4px);
}

.nav-link.active {
    background: white;
    color: var(--accent);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.nav-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.logout-btn {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    width: 100%;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 32px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel-bg);
    padding: 6px 16px 6px 6px;
    border-radius: 99px;
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
}

/* Cards & Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
}

.glass-panel:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.1);
    transform: translateY(-2px);
}

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

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th, .data-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

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

.data-table tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #f1f5f9;
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.success { background: #dcfce7; color: #166534; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.primary { background: #e0e7ff; color: #3730a3; }

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: white;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f1f5f9;
}

/* Login Page specific */
.auth-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    /* Main Layout */
    .app-shell {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 0 0 20px rgba(0,0,0,0.2);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    
    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 20px 16px;
        width: 100%;
    }
    
    /* Topbar & Hamburger Menu */
    .topbar {
        margin-bottom: 24px;
    }
    
    .topbar h2 {
        font-size: 1.25rem;
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: var(--panel-bg);
        border-radius: 12px;
        color: var(--text-main);
        cursor: pointer;
        margin-right: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    
    .topbar-left {
        display: flex;
        align-items: center;
    }

    /* Cards */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .glass-panel {
        padding: 16px;
    }
    
    /* Filter Forms */
    form[action="/users"], form[action="/meets"] {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    form .form-control {
        width: 100% !important;
    }
    
    .btn {
        width: 100%;
    }
    
    /* Hide some less critical buttons on mobile if they wrap poorly, but width:100% fixes most */
    .action-btn {
        margin-bottom: 6px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
    .sidebar-overlay {
        display: none !important;
    }
}
