/* Ermelo Cycling Club — Member & Admin Portal
   Styled to match the main site: dark background, green accents, rounded cards */

:root {
    --ecc-bg: #0d1512;
    --ecc-bg-alt: #121d18;
    --ecc-card: #16221c;
    --ecc-border: #223129;
    --ecc-green: #22c55e;
    --ecc-green-dark: #16a34a;
    --ecc-text: #eef4f0;
    --ecc-text-muted: #9fb3a8;
    --ecc-danger: #ef4444;
    --ecc-radius: 14px;
    --ecc-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
    background: radial-gradient(circle at top, var(--ecc-bg-alt), var(--ecc-bg) 60%);
    color: var(--ecc-text);
    min-height: 100vh;
}

a { color: var(--ecc-green); text-decoration: none; }
a:hover { text-decoration: underline; }

.ecc-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 6%;
    background: rgba(13, 21, 18, 0.9);
    border-bottom: 1px solid var(--ecc-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ecc-nav .brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    color: var(--ecc-text);
}

.ecc-nav .brand span { color: var(--ecc-green); }

.ecc-nav a.nav-link {
    color: var(--ecc-text-muted);
    margin-left: 22px;
    font-size: 0.95rem;
}

.ecc-nav a.nav-link:hover { color: var(--ecc-green); text-decoration: none; }

.ecc-wrap {
    max-width: 480px;
    margin: 60px auto;
    padding: 0 20px;
}

.ecc-wrap.wide { max-width: 980px; }

.ecc-card {
    background: var(--ecc-card);
    border: 1px solid var(--ecc-border);
    border-radius: var(--ecc-radius);
    box-shadow: var(--ecc-shadow);
    padding: 36px 34px;
}

.ecc-card h1, .ecc-card h2 {
    margin-top: 0;
    font-weight: 700;
}

.ecc-eyebrow {
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.75rem;
    color: var(--ecc-green);
    font-weight: 600;
    margin-bottom: 6px;
}

.ecc-form label {
    display: block;
    font-size: 0.88rem;
    color: var(--ecc-text-muted);
    margin: 16px 0 6px;
}

.ecc-form input,
.ecc-form select {
    width: 100%;
    padding: 12px 14px;
    background: #0f1a15;
    border: 1px solid var(--ecc-border);
    border-radius: 10px;
    color: var(--ecc-text);
    font-size: 0.95rem;
}

.ecc-form input:focus,
.ecc-form select:focus {
    outline: none;
    border-color: var(--ecc-green);
}

.ecc-form .row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ecc-btn {
    display: inline-block;
    margin-top: 24px;
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, var(--ecc-green), var(--ecc-green-dark));
    color: #06180d;
    font-weight: 700;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ecc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.35);
    text-decoration: none;
}

.ecc-btn.secondary {
    background: transparent;
    border: 1px solid var(--ecc-border);
    color: var(--ecc-text);
}

.ecc-btn.danger {
    background: linear-gradient(135deg, #f87171, var(--ecc-danger));
    color: #1a0505;
}

.ecc-btn.small {
    width: auto;
    padding: 8px 16px;
    font-size: 0.85rem;
    margin-top: 0;
}

.ecc-foot-link {
    text-align: center;
    margin-top: 20px;
    color: var(--ecc-text-muted);
    font-size: 0.9rem;
}

.ecc-alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.ecc-alert.success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.ecc-alert.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.ecc-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ecc-badge.active { background: rgba(34,197,94,0.15); color: #4ade80; }
.ecc-badge.pending { background: rgba(250,204,21,0.15); color: #facc15; }
.ecc-badge.suspended { background: rgba(239,68,68,0.15); color: #f87171; }
.ecc-badge.info { background: rgba(59,130,246,0.15); color: #60a5fa; }

.ecc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.ecc-stat {
    background: var(--ecc-card);
    border: 1px solid var(--ecc-border);
    border-radius: var(--ecc-radius);
    padding: 20px;
    text-align: center;
}

.ecc-stat .num { font-size: 1.8rem; font-weight: 700; color: var(--ecc-green); }
.ecc-stat .label { color: var(--ecc-text-muted); font-size: 0.85rem; margin-top: 4px; }

table.ecc-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--ecc-card);
    border-radius: var(--ecc-radius);
    overflow: hidden;
    border: 1px solid var(--ecc-border);
}

table.ecc-table th, table.ecc-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--ecc-border);
    font-size: 0.9rem;
}

table.ecc-table th {
    background: #0f1a15;
    color: var(--ecc-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

table.ecc-table tr:last-child td { border-bottom: none; }
table.ecc-table td.actions { white-space: nowrap; }
table.ecc-table td.actions .row-actions { display: inline-flex; align-items: center; gap: 6px; }

/* Inline registration form controls (event row "Action" cell) */
.ecc-reg-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.ecc-select-inline,
.ecc-input-inline {
    padding: 6px 8px;
    font-size: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--ecc-border);
    background: #0f1a15;
    color: var(--ecc-text);
    font-family: inherit;
}

.ecc-select-inline { width: 170px; }
.ecc-input-inline { width: 120px; }
.ecc-input-inline.discount { width: 110px; }

.ecc-page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ================= Dashboard Shell (sidebar layout) ================= */

.ecc-shell {
    display: flex;
    min-height: 100vh;
}

.ecc-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #0f1a15;
    border-right: 1px solid var(--ecc-border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.ecc-sidebar .brand {
    padding: 0 22px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--ecc-border);
    margin-bottom: 14px;
}

.ecc-sidebar .brand span { color: var(--ecc-green); }

.ecc-nav-group { margin-bottom: 6px; }

.ecc-nav-label {
    padding: 14px 22px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ecc-text-muted);
    font-weight: 600;
}

.ecc-sidebar a.side-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px;
    color: var(--ecc-text-muted);
    font-size: 0.92rem;
    border-left: 3px solid transparent;
}

.ecc-sidebar a.side-link:hover {
    color: var(--ecc-text);
    background: rgba(255,255,255,0.03);
    text-decoration: none;
}

.ecc-sidebar a.side-link.active {
    color: var(--ecc-green);
    background: rgba(34, 197, 94, 0.08);
    border-left-color: var(--ecc-green);
    font-weight: 600;
}

.ecc-side-badge {
    background: var(--ecc-green);
    color: #06180d;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
}

.ecc-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--ecc-border);
    background: rgba(13, 21, 18, 0.85);
    position: sticky;
    top: 0;
    z-index: 15;
}

.ecc-hamburger {
    display: none;
    background: none;
    border: 1px solid var(--ecc-border);
    color: var(--ecc-text);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.1rem;
}

.ecc-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ecc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ecc-green);
    background: #0f1a15;
}

.ecc-main {
    flex: 1;
    min-width: 0;
    padding: 28px 32px 60px;
}

.ecc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 19;
}

.ecc-overlay.show { display: block; }

@media (max-width: 900px) {
    .ecc-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 20;
        transition: left 0.25s ease;
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }
    .ecc-sidebar.open { left: 0; }
    .ecc-hamburger { display: inline-block; }
    .ecc-main { padding: 20px 16px 50px; }
    .ecc-form .row-2 { grid-template-columns: 1fr; }
    table.ecc-table:not(.ecc-table-stack) { white-space: nowrap; }
}

/* Overview cards / activity feed */

.ecc-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .ecc-grid-2 { grid-template-columns: 1fr; }
}

.ecc-activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--ecc-border);
    font-size: 0.88rem;
}
.ecc-activity-item:last-child { border-bottom: none; }
.ecc-activity-icon {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(34,197,94,0.12);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 1rem;
}

.ecc-event-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--ecc-border);
    font-size: 0.88rem;
}
.ecc-event-mini:last-child { border-bottom: none; }
.ecc-event-date {
    background: #0f1a15;
    border: 1px solid var(--ecc-border);
    border-radius: 10px;
    padding: 6px 10px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--ecc-green);
    min-width: 52px;
}

.ecc-empty {
    text-align: center;
    color: var(--ecc-text-muted);
    padding: 30px 10px;
    font-size: 0.9rem;
}

.ecc-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.ecc-tabs a {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--ecc-border);
    color: var(--ecc-text-muted);
    font-size: 0.85rem;
}
.ecc-tabs a.active {
    background: var(--ecc-green);
    border-color: var(--ecc-green);
    color: #06180d;
    font-weight: 600;
    text-decoration: none;
}

.ecc-doc-list a.doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #0f1a15;
    border: 1px solid var(--ecc-border);
    border-radius: 10px;
    margin-bottom: 10px;
    color: var(--ecc-text);
}
.ecc-doc-list a.doc-row:hover { border-color: var(--ecc-green); text-decoration: none; }

.ecc-msg-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}
.ecc-msg-bubble.from-member {
    background: var(--ecc-green);
    color: #06180d;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.ecc-msg-bubble.from-admin {
    background: #0f1a15;
    border: 1px solid var(--ecc-border);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}
.ecc-msg-meta { font-size: 0.72rem; opacity: 0.7; margin-top: 4px; }

/* ================= Table scroll wrapper ================= */

.ecc-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ================= Stacked table (mobile-responsive) =================
   Opt-in via class="ecc-table ecc-table-stack" (see guest_events.php).
   Below 768px, rows turn into self-contained "blurb" cards instead of a
   horizontally-scrolling table — no side-scrolling, and each event's
   details read top-to-bottom the way they would in a card list. Each
   <td> needs a data-label="..." attribute. */

@media (max-width: 768px) {
    .ecc-wrap { margin: 24px auto; padding: 0 14px; }
    .ecc-wrap .ecc-card { padding: 20px 16px; }

    /* The scroll wrapper is only needed for real tables; stacked cards
       never overflow, so let it size to content instead of scrolling. */
    .ecc-table-scroll:has(table.ecc-table-stack) {
        overflow-x: visible;
    }

    table.ecc-table-stack {
        white-space: normal;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    table.ecc-table-stack thead { display: none; }

    table.ecc-table-stack, table.ecc-table-stack tbody {
        display: block;
        width: 100%;
    }

    table.ecc-table-stack tr {
        display: block;
        width: 100%;
        background: #0f1a15;
        border: 1px solid var(--ecc-border);
        border-radius: 14px;
        padding: 16px;
        margin-bottom: 12px;
    }
    table.ecc-table-stack tr:last-child { margin-bottom: 0; }

    table.ecc-table-stack td {
        display: block;
        width: 100%;
        border-bottom: none;
        padding: 0;
        text-align: left;
        overflow-wrap: anywhere;
    }

    table.ecc-table-stack td + td { margin-top: 8px; }

    /* Title + category sit at the top of the card, full width. */
    table.ecc-table-stack td[data-label="Event"] {
        font-size: 1.02rem;
        padding-bottom: 4px;
        border-bottom: 1px solid var(--ecc-border);
        margin-bottom: 4px;
    }

    /* Date / Location read as small icon-prefixed lines, no shouty label. */
    table.ecc-table-stack td[data-label="Date"],
    table.ecc-table-stack td[data-label="Location"] {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-size: 0.85rem;
        color: var(--ecc-text-muted);
    }
    table.ecc-table-stack td[data-label="Date"]::before,
    table.ecc-table-stack td[data-label="Location"]::before {
        flex-shrink: 0;
        line-height: 1.4;
    }
    table.ecc-table-stack td[data-label="Date"]::before { content: "📅"; }
    table.ecc-table-stack td[data-label="Location"]::before { content: "📍"; }
    table.ecc-table-stack td[data-label="Location"] a { color: inherit; }

    /* Fee / Status / Payment read the same way as Date / Location — a
       small icon-prefixed line, not a shouty labelled row. */
    table.ecc-table-stack td[data-label="Fee"],
    table.ecc-table-stack td[data-label="Status"],
    table.ecc-table-stack td[data-label="Payment"] {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.85rem;
        color: var(--ecc-text-muted);
    }
    table.ecc-table-stack td[data-label="Fee"]::before { content: "💰"; flex-shrink: 0; }
    table.ecc-table-stack td[data-label="Status"]::before { content: "🏷️"; flex-shrink: 0; }
    table.ecc-table-stack td[data-label="Payment"]::before { content: "💳"; flex-shrink: 0; }

    table.ecc-table-stack td[data-label="Action"] {
        margin-top: 14px;
    }
    table.ecc-table-stack td[data-label="Action"] .ecc-btn {
        display: block;
        width: 100%;
        text-align: center;
    }

    /* Registration form (fee tier / race category / discount code) stacks
       into full-width, easily-tappable fields instead of a cramped row. */
    table.ecc-table-stack .ecc-reg-form {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 0;
    }
    table.ecc-table-stack .ecc-select-inline,
    table.ecc-table-stack .ecc-input-inline {
        width: 100%;
        box-sizing: border-box;
        padding: 11px 12px;
        font-size: 0.9rem;
    }
    table.ecc-table-stack .ecc-reg-form .ecc-btn {
        margin-top: 4px;
    }
}

/* ================= Dropdown action menu ================= */

.ecc-dropdown {
    position: relative;
    display: inline-block;
}

.ecc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--ecc-border);
    background: transparent;
    color: var(--ecc-text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    vertical-align: middle;
}

.ecc-icon-btn:hover {
    border-color: var(--ecc-green);
    color: var(--ecc-green);
    text-decoration: none;
}

.ecc-dropdown-toggle {
    background: transparent;
    border: none;
    color: var(--ecc-green);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    font-family: inherit;
    vertical-align: middle;
}

.ecc-dropdown-toggle:hover { text-decoration: underline; }

.ecc-dropdown-toggle .caret {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.ecc-dropdown-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }

.ecc-dropdown-menu {
    position: fixed;
    min-width: 190px;
    background: var(--ecc-card);
    border: 1px solid var(--ecc-border);
    border-radius: 10px;
    box-shadow: var(--ecc-shadow);
    padding: 6px;
    z-index: 100;
    display: none;
}

.ecc-dropdown-menu.show { display: block; }

.ecc-dropdown-menu form { margin: 0; }

.ecc-dropdown-menu button,
.ecc-dropdown-menu a.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--ecc-text);
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 0.86rem;
    cursor: pointer;
    font-family: inherit;
}

.ecc-dropdown-menu button:hover,
.ecc-dropdown-menu a.dropdown-item:hover {
    background: rgba(34, 197, 94, 0.1);
    color: var(--ecc-green);
    text-decoration: none;
}

.ecc-dropdown-menu button.danger-item:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}

.ecc-dropdown-divider {
    height: 1px;
    background: var(--ecc-border);
    margin: 6px 4px;
}