/* ============================================================================
   iRunSA Modern Theme — shared styles for admin portal & redesigned event cards
   Brand palette derived from the iRunSA logo:
     --brand-orange : #FCA920   (logo accent)
     --brand-dark   : #1a1a1a   (logo body)
     --brand-light  : #FCFCFC   (logo highlights)
   ========================================================================== */

:root {
    --brand-orange: #FCA920;
    --brand-orange-hover: #e09518;
    --brand-orange-soft: #fff4dc;
    --brand-dark: #1a1a1a;
    --brand-dark-2: #252830;
    --brand-light: #FCFCFC;
    --admin-bg: #f7f8fa;
    --admin-surface: #ffffff;
    --admin-border: #e6e8ed;
    --admin-muted: #6c757d;
    --admin-text: #1f2328;
    --admin-success: #198754;
    --admin-warning: #f4a300;
    --admin-danger: #dc3545;
}

/* ============================================================================
   ADMIN PORTAL
   ========================================================================== */

.admin-shell {
    padding: 100px 2rem 4rem 2rem;
    background: var(--admin-bg);
    min-height: 100vh;
    color: var(--admin-text);
}

/* Force dark text inside the admin area regardless of public-site theme cascade */
.admin-shell,
.admin-shell h1,
.admin-shell h2,
.admin-shell h3,
.admin-shell h4,
.admin-shell h5,
.admin-shell h6,
.admin-shell p,
.admin-shell label,
.admin-shell span,
.admin-shell a {
    color: var(--admin-text);
}

.admin-shell h1 {
    color: var(--brand-dark) !important;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.admin-shell h2,
.admin-shell h3,
.admin-shell h4 {
    color: var(--brand-dark) !important;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.admin-shell .text-muted { color: var(--admin-muted) !important; }
.admin-shell a:not(.btn-brand):not(.btn-dark-pill):not(.btn-confirm):not(.btn-assign):not(.btn-unassign) {
    color: var(--brand-orange);
    text-decoration: none;
}
.admin-shell a:hover { color: var(--brand-orange-hover); }

.admin-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04), 0 1px 2px rgba(16, 24, 40, 0.02);
    margin-bottom: 1.5rem;
}

/* Stat tiles */
.stat-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
    border-top: 4px solid var(--brand-dark);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06); }
.stat-card.paid { border-top-color: var(--admin-success); }
.stat-card.payonday { border-top-color: var(--brand-orange); }
.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--brand-dark);
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 0.5rem;
    font-weight: 600;
}
.stat-card .stat-scope {
    font-size: 0.7rem;
    color: var(--admin-muted);
    margin-top: 0.35rem;
    font-style: italic;
    opacity: 0.85;
}

/* Tables */
.events-table, .participants-table, .pool-table {
    width: 100%;
    background: var(--admin-surface);
    border-collapse: separate;
    border-spacing: 0;
}
.events-table th, .participants-table th, .pool-table th {
    background: var(--brand-dark);
    color: var(--brand-light);
    padding: 0.85rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    text-align: left;
}
.events-table th:first-child, .participants-table th:first-child, .pool-table th:first-child { border-top-left-radius: 8px; }
.events-table th:last-child, .participants-table th:last-child, .pool-table th:last-child { border-top-right-radius: 8px; }
.events-table td, .participants-table td, .pool-table td {
    padding: 0.85rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text);
    font-size: 0.9rem;
}
.events-table tr:hover, .participants-table tr:hover, .pool-table tr:hover { background: #fafbfc; }

/* Badges */
.badge-paid {
    background: var(--admin-success);
    color: #fff;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.badge-payonday {
    background: var(--brand-orange);
    color: var(--brand-dark);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.badge-other {
    background: var(--admin-muted);
    color: #fff;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-storage {
    background: #eef0f3;
    color: var(--brand-dark);
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-weight: 600;
}

/* Buttons */
.btn-brand {
    background: var(--brand-orange);
    color: var(--brand-dark);
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
}
.btn-brand:hover { background: var(--brand-orange-hover); color: var(--brand-dark); text-decoration: none; }
.btn-brand:active { transform: translateY(1px); }

.btn-dark-pill {
    background: var(--brand-dark);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-dark-pill:hover { background: var(--brand-orange); color: var(--brand-dark); text-decoration: none; }

.btn-confirm {
    background: var(--admin-success);
    color: #fff;
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-confirm:hover { background: #145c32; }

.btn-assign {
    background: var(--brand-orange);
    color: var(--brand-dark);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.btn-assign:hover { background: var(--brand-orange-hover); }

.btn-unassign {
    background: transparent;
    color: var(--admin-danger);
    border: 1px solid var(--admin-danger);
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-unassign:hover { background: var(--admin-danger); color: #fff; }

/* Bib number badge */
.bib-number {
    background: var(--brand-dark);
    color: var(--brand-orange);
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.85rem;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    letter-spacing: 0.5px;
    display: inline-block;
}

.bib-select {
    font-size: 0.82rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--admin-border);
    max-width: 130px;
    background: #fff;
}

/* Filter pills */
.filter-pill {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: var(--admin-surface);
    color: var(--brand-dark);
    border: 1px solid var(--admin-border);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.15s ease;
}
.filter-pill:hover { border-color: var(--brand-dark); text-decoration: none; color: var(--brand-dark); }
.filter-pill.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.filter-pill.payonday.active { background: var(--brand-orange); color: var(--brand-dark); border-color: var(--brand-orange); }
.filter-pill.paid.active { background: var(--admin-success); color: #fff; border-color: var(--admin-success); }

/* Status banners */
.status-banner {
    padding: 0.9rem 1.1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    border: 1px solid transparent;
}
.status-success { background: #d1e7dd; color: #0f5132; border-color: #badbcc; }
.status-error { background: #f8d7da; color: #842029; border-color: #f5c2c7; }

/* Form labels in admin */
.form-label-sm {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
    display: block;
}

/* ============================================================================
   ADMIN LOGIN (override the dark public layout for the login card)
   ========================================================================== */

.admin-login-wrapper {
    max-width: 420px;
    margin: 120px auto 80px auto;
    padding: 2.5rem;
    background: var(--admin-surface);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    border: 1px solid var(--admin-border);
}
.admin-login-wrapper h2 {
    color: var(--brand-dark);
    font-weight: 800;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: -0.02em;
}
.admin-login-wrapper .form-control {
    background: #f7f8fa !important;
    color: var(--admin-text) !important;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
}
.admin-login-wrapper .form-control:focus {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(252, 169, 32, 0.18);
}
.admin-login-wrapper .form-label {
    color: var(--admin-text);
    font-weight: 600;
    font-size: 0.85rem;
}
.admin-login-wrapper .btn-primary {
    background: var(--brand-dark);
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
    padding: 0.7rem;
}
.admin-login-wrapper .btn-primary:hover {
    background: var(--brand-orange);
    color: var(--brand-dark);
}

/* ============================================================================
   LANDING PAGE EVENT CARDS — compact, modern grid
   ========================================================================== */

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.event-tile {
    position: relative;
    background: #15171c;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.event-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    border-color: rgba(252, 169, 32, 0.3);
}

.event-tile-media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #0d0e12;
}

.event-tile-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.event-tile:hover .event-tile-media img {
    transform: scale(1.07);
}

/* Date chip top-left */
.event-tile-date {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--brand-dark);
    border-radius: 10px;
    padding: 6px 10px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(6px);
}
.event-tile-date .day {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--brand-orange);
    letter-spacing: -0.02em;
}
.event-tile-date .month {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-top: 2px;
    color: var(--brand-dark);
}

/* Category chip top-right */
.event-tile-cat {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(252, 169, 32, 0.95);
    color: var(--brand-dark);
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Bottom gradient overlay so title is always readable */
.event-tile-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.35) 0%, transparent 45%);
    pointer-events: none;
}

.event-tile-body {
    padding: 1rem 1.1rem 1.1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.event-tile-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-light);
    line-height: 1.3;
    margin: 0 0 0.45rem;
    letter-spacing: -0.01em;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.event-tile-title a {
    color: inherit;
    text-decoration: none;
}

.event-tile-title a:hover {
    color: var(--brand-orange);
}

.event-tile-desc {
    font-size: 0.82rem;
    color: rgba(252, 252, 252, 0.6);
    margin: 0 0 0.85rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.event-tile-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.72rem;
    color: rgba(252, 252, 252, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.event-tile-foot .reg-close {
    display: flex;
    flex-direction: column;
}
.event-tile-foot .reg-close strong {
    color: var(--brand-orange);
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 1px;
    font-weight: 700;
}
.event-tile-foot .arrow {
    color: var(--brand-orange);
    font-size: 1rem;
    transition: transform 0.2s ease;
}
.event-tile:hover .event-tile-foot .arrow {
    transform: translateX(4px);
}

/* Fade-in on appear (works without external libs) */
.event-tile {
    opacity: 0;
    transform: translateY(12px);
    animation: tile-in 0.5s ease forwards;
}
.event-tile:nth-child(1)  { animation-delay: 0.05s; }
.event-tile:nth-child(2)  { animation-delay: 0.10s; }
.event-tile:nth-child(3)  { animation-delay: 0.15s; }
.event-tile:nth-child(4)  { animation-delay: 0.20s; }
.event-tile:nth-child(5)  { animation-delay: 0.25s; }
.event-tile:nth-child(6)  { animation-delay: 0.30s; }
.event-tile:nth-child(7)  { animation-delay: 0.35s; }
.event-tile:nth-child(8)  { animation-delay: 0.40s; }

@keyframes tile-in {
    to { opacity: 1; transform: translateY(0); }
}
