/* ClubSync - Shared "logged-in app" shell
   Used by every page behind login: sidebar, header, footer, and the
   event-card component that appears on more than one page.
   Page-specific files (dashboard.css, browse-events.css, ...) only add
   what's unique to that page. */

:root {
    --color-primary: #00236f;
    --color-primary-container: #1e3a8a;
    --color-secondary: #0058be;
    --color-secondary-container: #2170e4;
    --color-on-primary: #ffffff;
    --color-surface: #eef1fb;
    --color-surface-container-lowest: #ffffff;
    --color-surface-container: #e7eefe;
    --color-on-surface: #151c27;
    --color-on-surface-variant: #444651;
    --color-outline-variant: #d7dced;
    --color-error: #ba1a1a;
    --color-error-container: #ffdad6;
    --radius: 12px;
}

* { box-sizing: border-box; }

body.app-body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    background: var(--color-surface);
    color: var(--color-on-surface);
}

a { font-family: inherit; }

.dash-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Sidebar ---------- */
.dash-sidebar {
    width: 280px;
    flex: 0 0 280px;
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    overflow-y: auto;
}

.dash-brand {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 28px;
    padding: 0 6px;
}

.dash-brand .logo-box {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-brand-text .club-name {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.dash-brand-text .powered-by {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin: 4px 0 0;
}

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

.dash-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    position: relative;
}

.dash-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }

.dash-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.dash-nav a.active {
    background: var(--color-secondary-container);
    color: #ffffff;
}

.dash-nav .notif-dot {
    position: absolute;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.dash-sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.dash-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px;
    margin-bottom: 12px;
}

.dash-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-secondary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
    flex-shrink: 0;
}

.dash-user-info { flex: 1; min-width: 0; }

.dash-user-info .name {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.dash-user-info .role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    margin: 2px 0 0;
}

.dash-logout-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 218, 214, 0.92);
    color: #93000a;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.dash-logout-btn:hover {
    background: #ffdad6;
}

/* ---------- Main area ---------- */
.dash-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: visible;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 32px;
    padding: 22px 32px;
    background: var(--color-surface-container-lowest);
    border-bottom: 1px solid var(--color-outline-variant);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.dash-header h1 {
    font-size: 25px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.dash-search { position: relative; }

.dash-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--color-on-surface-variant);
}

.dash-search input {
    padding: 10px 16px 10px 38px;
    border-radius: 999px;
    border: 1px solid var(--color-outline-variant);
    background: var(--color-surface-container);
    font-size: 14px;
    width: 260px;
    max-width: 40vw;
    outline: none;
    font-family: inherit;
    color: var(--color-on-surface);
}

.dash-search input:focus { border-color: var(--color-secondary); }

.dash-bell {
    position: relative;
    color: var(--color-on-surface-variant);
    display: flex;
}

.dash-bell svg { width: 22px; height: 22px; }

.dash-bell .dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.dash-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.dash-body-content {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
}

/* ---------- Section header ---------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-header h2 {
    font-size: 21px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.section-header a {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-secondary);
    text-decoration: none;
}

.section-header a:hover { text-decoration: underline; }

/* ---------- Event card ---------- */
.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 22px;
}

.event-card {
    background: var(--color-surface-container-lowest);
    border: 1px solid var(--color-outline-variant);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.event-banner {
    height: 140px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
}

.event-banner svg { width: 44px; height: 44px; }

.event-banner .badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
}

.event-body {
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.event-body h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--color-on-surface);
    line-height: 1.3;
}

.event-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-on-surface-variant);
}

.event-meta svg { width: 15px; height: 15px; flex-shrink: 0; }

.event-capacity { margin-top: 4px; }

.event-capacity-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-on-surface-variant);
    margin-bottom: 6px;
}

.capacity-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--color-surface-container);
    overflow: hidden;
}

.capacity-bar {
    height: 100%;
    background: var(--color-secondary-container);
    border-radius: 999px;
}

.capacity-bar.is-full { background: #dc2626; }

.event-cta {
    margin-top: auto;
    display: block;
    text-align: center;
    padding: 10px;
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 14px;
    border-radius: 10px;
    text-decoration: none;
    background: #ffffff;
    transition: background-color .15s, color .15s;
}

.event-cta:hover { background: var(--color-primary); color: #ffffff; }

.event-cta.is-disabled {
    border-color: var(--color-outline-variant);
    color: #9aa0ab;
    background: #f3f4f7;
    cursor: default;
    pointer-events: none;
}

/* ---------- Footer ---------- */
.dash-footer {
    padding: 18px 32px;
    border-top: 1px solid var(--color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-on-surface-variant);
    flex-wrap: wrap;
    gap: 8px;
    background: var(--color-surface-container-lowest);
}

.dash-footer .links { display: flex; gap: 18px; }
.dash-footer a { color: var(--color-on-surface-variant); text-decoration: none; }
.dash-footer a:hover { color: var(--color-secondary); }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 14px;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--color-error-container); color: #93000a; }
.alert-success { background: #d7f5e3; color: #0a6b3d; }

/* ---------- Club Switcher Component ---------- */
.cs-club-switcher {
    position: relative;
    display: inline-block;
}

.cs-club-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cs-club-trigger:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.cs-club-trigger svg {
    width: 16px;
    height: 16px;
    color: #0284c7;
}

.cs-chevron {
    transition: transform 0.2s ease;
}

.cs-club-trigger[aria-expanded="true"] .cs-chevron {
    transform: rotate(180deg);
}

.cs-club-name-single {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 13.5px;
    font-weight: 600;
}

.cs-club-browse-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.cs-club-browse-link:hover {
    background: #bae6fd;
}

.cs-club-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 290px;
    max-height: 360px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 6px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cs-club-dropdown[hidden] {
    display: none !important;
}

.cs-club-form {
    margin: 0;
    padding: 0;
}

.cs-club-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    text-align: left;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.12s ease;
}

.cs-club-item:hover {
    background: #f1f5f9;
}

.cs-club-item--active {
    background: #f0fdf4 !important;
    color: #166534;
    font-weight: 600;
    cursor: default;
}

.cs-club-item--join {
    color: #0284c7;
    font-weight: 600;
    justify-content: center;
    padding: 9px 12px;
    background: #f8fafc;
}

.cs-club-item--join:hover {
    background: #f0f9ff;
}

.cs-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

.cs-role-badge {
    display: inline-block;
    padding: 2px 7px;
    font-size: 10.5px;
    font-weight: 700;
    border-radius: 9999px;
    background: #e2e8f0;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cs-role-badge--active {
    background: #dcfce7;
    color: #15803d;
}

@media (max-width: 900px) {
    .dash-layout { flex-direction: column; }

    .dash-sidebar {
        width: 100%;
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        padding: 16px 20px;
    }

    .dash-brand { margin-bottom: 0; }
    .dash-nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
    .dash-nav a { padding: 8px 10px; font-size: 13px; }
    .dash-sidebar-footer { border-top: none; margin-top: 0; padding-top: 0; }

    .dash-search input { width: 160px; }
}
