/* ============================================================
   SportCarpool – Theme (Tailwind + Alpine, no Bootstrap)
   Palette: Red #C41A1A | Black #111111 | White #FFFFFF
   ============================================================ */

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

/* ---------- Alpine cloak ---------- */
[x-cloak] { display: none !important; }

/* ---------- Root variables ---------- */
:root {
    --sp-red:       #C41A1A;
    --sp-red-dk:    #9B1515;
    --sp-black:     #111111;
    --sp-dark:      #1E1E1E;
    --sp-gray:      #6B7280;
    --sp-light:     #FFF5F5;
    --sp-offwhite:  #F7F7F7;
    --sp-border:    #E8E0E0;
    --shadow-sport: 0 4px 20px rgba(196,26,26,0.12);
    --shadow-sport-lg: 0 8px 32px rgba(196,26,26,0.18);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Nunito', system-ui, sans-serif;
    background: var(--sp-offwhite);
    color: var(--sp-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Oswald', sans-serif; letter-spacing: 0.02em; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--sp-red); text-decoration: none; touch-action: manipulation; }
a:hover { text-decoration: underline; }
main { flex: 1; padding: 1rem 1rem 2rem; max-width: 1200px; margin: 0 auto; width: 100%; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- Navbar ---------- */
.navbar {
    background: linear-gradient(135deg, var(--sp-black) 0%, #2a0808 100%);
    box-shadow: 0 2px 16px rgba(0,0,0,0.45);
    border-bottom: 3px solid var(--sp-red);
    position: sticky;
    top: 0;
    z-index: 1060;
    padding: 4px 0;
}
.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.navbar-brand {
    font-family: 'Oswald', sans-serif;
    padding: 4px 0;
    text-decoration: none !important;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.navbar-logo { height: 86px; width: auto; display: block; object-fit: contain; }
.navbar-nav {
    display: flex;
    align-items: center;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.navbar-nav::-webkit-scrollbar { display: none; }
.nav-link {
    color: rgba(255,255,255,0.82) !important;
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 6px 12px;
    text-decoration: none !important;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, color 0.2s;
    touch-action: manipulation;
}
.nav-link:hover { background: rgba(196,26,26,0.25); color: #fff !important; }
.nav-link.text-warning { color: var(--sp-red) !important; }
@media (max-width: 576px) {
    .navbar-logo { height: 52px; }
    .nav-link { font-size: 0.78rem; padding: 5px 7px; }
}

/* ---------- Footer ---------- */
.footer {
    background: linear-gradient(135deg, var(--sp-black) 0%, #2a0808 100%);
    border-top: 3px solid var(--sp-red);
    padding: 0.75rem 1rem;
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 0.875rem;
}

/* ---------- Buttons ---------- */
button, .btn, a, input, select, textarea { touch-action: manipulation; }
button i, .btn i, a.btn i { pointer-events: none; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.1s;
    white-space: nowrap;
    line-height: 1.4;
}
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.78rem; min-height: 30px; }
.btn-w-full { width: 100%; }

.btn-sport-primary { background: var(--sp-red); border-color: var(--sp-red); color: #fff; }
.btn-sport-primary:hover, .btn-sport-primary:focus {
    background: var(--sp-red-dk); border-color: var(--sp-red-dk); color: #fff;
    box-shadow: 0 4px 14px rgba(196,26,26,0.4); transform: translateY(-1px); text-decoration: none !important;
}
.btn-sport-accent { background: var(--sp-red); border-color: var(--sp-red); color: #fff; }
.btn-sport-accent:hover { background: var(--sp-red-dk); border-color: var(--sp-red-dk); color: #fff; }

.btn-outline-sport { color: var(--sp-red); border-color: var(--sp-red); background: transparent; }
.btn-outline-sport:hover, .btn-outline-sport.active { background: var(--sp-red); color: #fff; text-decoration: none !important; }

.btn-outline-secondary { color: #6b7280; border-color: #d1d5db; background: transparent; }
.btn-outline-secondary:hover { background: #f3f4f6; color: #374151; text-decoration: none !important; }

.btn-outline-danger { color: #dc2626; border-color: #dc2626; background: transparent; }
.btn-outline-danger:hover { background: #dc2626; color: #fff; }

.btn-outline-success { color: #16a34a; border-color: #16a34a; background: transparent; }
.btn-outline-success:hover { background: #16a34a; color: #fff; }

.btn-outline-primary { color: #2563eb; border-color: #2563eb; background: transparent; }
.btn-outline-primary:hover { background: #2563eb; color: #fff; }

.btn-warning  { background: #fbbf24; border-color: #fbbf24; color: #1f2937; font-weight: 700; }
.btn-danger   { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 700; }
.btn-danger:hover { background: #b91c1c; }

.btn-link {
    background: transparent; border-color: transparent; color: var(--sp-red);
    text-transform: none; letter-spacing: 0; font-family: 'Nunito', sans-serif;
    font-weight: 600; padding: 0; min-height: unset;
}
.btn-link:hover { text-decoration: underline !important; }
.btn-link.text-white  { color: #fff !important; }
.btn-link.text-danger { color: #dc2626 !important; }
.btn-link.text-muted  { color: var(--sp-gray) !important; }

.btn-group { display: flex; }
.btn-group .btn { border-radius: 0; border-right-width: 0; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group .btn:last-child  { border-radius: 0 6px 6px 0; border-right-width: 2px; }

/* ---------- Cards ---------- */
.card { background: #fff; border-radius: 10px; border: 1px solid var(--sp-border); overflow: hidden; }
.shadow-sport { box-shadow: var(--shadow-sport) !important; }
.card.shadow-sport:hover { box-shadow: var(--shadow-sport-lg) !important; transition: box-shadow 0.25s; }
.card-header {
    font-family: 'Oswald', sans-serif; letter-spacing: 0.03em;
    padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--sp-border);
}
.card-header.bg-sport-primary { background: var(--sp-red) !important; border-bottom: none; color: #fff; }
.card-header.bg-danger        { background: #dc2626 !important; border-bottom: none; color: #fff; }
.card-body   { padding: 1.25rem; }
.card-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--sp-border); }
@media (max-width: 767px) { .card-body { padding: 0.75rem !important; } }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 0.72rem; font-weight: 700; padding: 3px 7px;
    border-radius: 4px; letter-spacing: 0.03em; white-space: nowrap; line-height: 1.4;
}
.badge i { pointer-events: none; font-size: 0.72rem; }
.bg-sport-primary  { background: var(--sp-red) !important; color: #fff; }
.bg-sport-secondary { background: var(--sp-black) !important; color: #fff; }
.badge.bg-success   { background: #16a34a; color: #fff; }
.badge.bg-danger    { background: #dc2626; color: #fff; }
.badge.bg-warning   { background: #fbbf24; color: #1f2937; }
.badge.bg-info      { background: #0ea5e9; color: #fff; }
.badge.bg-secondary { background: #6b7280; color: #fff; }
.badge.bg-primary   { background: #2563eb; color: #fff; }
.badge.bg-light     { background: #f3f4f6; color: #1f2937; border: 1px solid #d1d5db; }
.badge.font-monospace { font-family: 'Courier New', monospace; }
@media (max-width: 576px) { .badge { font-size: 0.65rem; } }

/* ---------- Alerts ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.65rem 0.9rem; border-radius: 6px;
    border-left: 4px solid transparent; font-size: 0.9rem; margin-bottom: 0.75rem;
}
.alert i { pointer-events: none; flex-shrink: 0; margin-top: 2px; }
.alert-success { background: #f0fdf4; border-color: #16a34a; color: #14532d; }
.alert-danger  { background: #fef2f2; border-color: var(--sp-red); color: #7f1d1d; }
.alert-warning { background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.alert-info    { background: #eff6ff; border-color: #3b82f6; color: #1e3a8a; }
.alert-close {
    margin-left: auto; background: none; border: none; font-size: 1.1rem;
    cursor: pointer; opacity: 0.5; padding: 0 0 0 0.5rem; color: inherit; flex-shrink: 0; line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ---------- Forms ---------- */
.form-label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.3rem; color: var(--sp-dark); }

.form-control, .form-select {
    display: block; width: 100%; padding: 0.45rem 0.75rem;
    font-size: 0.9rem; font-family: 'Nunito', sans-serif; line-height: 1.5;
    color: var(--sp-dark); background: #fff; border: 1.5px solid #d1d5db;
    border-radius: 6px; transition: border-color 0.15s, box-shadow 0.15s;
    outline: none; -webkit-appearance: none; appearance: none;
    box-sizing: border-box;
}
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center;
    padding-right: 2rem; cursor: pointer;
}
.form-control:focus, .form-select:focus { border-color: var(--sp-red); box-shadow: 0 0 0 3px rgba(196,26,26,0.12); }
.form-control.is-invalid, .form-select.is-invalid { border-color: #dc2626; }
.form-control:read-only { background: #f9fafb; color: var(--sp-gray); }
.form-control-sm, .form-select-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.form-select-sm { padding-right: 1.75rem; }

.form-text { font-size: 0.78rem; color: var(--sp-gray); margin-top: 0.25rem; line-height: 1.4; }
.invalid-feedback { font-size: 0.8rem; color: #dc2626; margin-top: 0.25rem; }

.form-check { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.25rem 0; }
.form-check-input { width: 1rem; height: 1rem; margin-top: 3px; accent-color: var(--sp-red); cursor: pointer; flex-shrink: 0; }
.form-check-label { font-size: 0.875rem; cursor: pointer; line-height: 1.4; }

.form-switch .form-check-input {
    width: 2.2rem; height: 1.15rem; border-radius: 999px;
    appearance: none; -webkit-appearance: none;
    background: #d1d5db; position: relative; transition: background 0.2s; margin-top: 2px;
}
.form-switch .form-check-input::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 0.75rem; height: 0.75rem; border-radius: 50%;
    background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.form-switch .form-check-input:checked { background: var(--sp-red); }
.form-switch .form-check-input:checked::after { transform: translateX(1.05rem); }

.input-group {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    width: 100%;
}
.input-group .form-control,
.input-group .form-select {
    border-radius: 0;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.input-group-text {
    display: flex; align-items: center; padding: 0.45rem 0.75rem;
    background: var(--sp-light); border: 1.5px solid #d1d5db;
    color: var(--sp-red); font-size: 0.9rem; white-space: nowrap; flex-shrink: 0;
}
.input-group > :first-child { border-radius: 6px 0 0 6px !important; }
.input-group > :last-child  { border-radius: 0 6px 6px 0 !important; }
.input-group > :only-child  { border-radius: 6px !important; }
.input-group .btn:last-child { border-radius: 0 6px 6px 0 !important; }
.input-group-text + .form-control,
.input-group-text + .form-select { border-left: none; }
.input-group .invalid-feedback { width: 100%; order: 99; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: middle; }
.table thead tr { border-bottom: 2px solid var(--sp-red); }
.table thead th { font-size: 0.75rem; text-transform: uppercase; color: var(--sp-gray); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: none; }
.table-sm th, .table-sm td { padding: 0.35rem 0.6rem; font-size: 0.875rem; }
.table-responsive { overflow-x: auto; }
.align-middle { vertical-align: middle !important; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 4px);
    min-width: 168px; max-width: calc(100vw - 1.5rem); background: #fff; border: 1px solid #e5e7eb;
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 9999; padding: 4px 0; list-style: none; margin: 0;
    /* Prevent overflow on small screens (e.g. iPhone) */
    left: auto !important;
}
.dropdown-item {
    display: flex; align-items: center; gap: 6px;
    padding: 0.45rem 0.85rem; font-size: 0.875rem; color: var(--sp-dark);
    background: transparent; border: none; width: 100%; cursor: pointer;
    text-align: left; text-decoration: none; touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1); font-family: 'Nunito', sans-serif;
}
.dropdown-item:hover { background: var(--sp-light); color: var(--sp-red); }
.dropdown-item i { pointer-events: none; }
.dropdown-header {
    display: block; padding: 0.35rem 0.85rem; font-size: 0.72rem;
    font-weight: 700; color: var(--sp-gray); text-transform: uppercase; letter-spacing: 0.05em;
}
.dropdown-menu form { padding: 0; touch-action: manipulation; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-box {
    background: #fff; border-radius: 12px; width: 100%; max-width: 500px;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid #e5e7eb;
}
.modal-title { font-family: 'Oswald', sans-serif; font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-body  { padding: 1.25rem; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 0.5rem; padding: 0.75rem 1.25rem; border-top: 1px solid #e5e7eb;
}
.modal-close {
    background: none; border: none; font-size: 1.25rem; cursor: pointer;
    color: var(--sp-gray); line-height: 1; padding: 0; opacity: 0.7;
}
.modal-close:hover { opacity: 1; color: var(--sp-dark); }

/* ---------- Date badges ---------- */
.date-badge {
    min-width: 52px; background: var(--sp-light); border: 2px solid var(--sp-red);
    border-radius: 8px; padding: 6px 8px; flex-shrink: 0; text-align: center;
}
.date-badge-month { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; color: var(--sp-red); letter-spacing: 0.05em; }
.date-badge-day   { font-size: 1.5rem; font-weight: 800; color: var(--sp-dark); line-height: 1.1; font-family: 'Oswald', sans-serif; }
.date-badge-white {
    min-width: 52px; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.5);
    border-radius: 8px; padding: 6px 8px; flex-shrink: 0; text-align: center;
}
@media (max-width: 767px) {
    .date-badge { min-width: 44px; padding: 4px 6px; }
    .date-badge-day { font-size: 1.2rem; }
    .date-badge-month { font-size: 0.6rem; }
    main { padding-left: 0.75rem; padding-right: 0.75rem; }
    h1 { font-size: 1.4rem; }
}
@media (max-width: 576px) {
    .date-badge { min-width: 40px; }
    .date-badge-day { font-size: 1.1rem; }
}

/* ---------- Color & display utilities ---------- */
.text-sport-primary  { color: var(--sp-red) !important; }
.text-sport-secondary { color: var(--sp-black) !important; }
.text-muted          { color: var(--sp-gray) !important; }
.text-danger         { color: #dc2626 !important; }
.text-success        { color: #16a34a !important; }
.text-warning        { color: #d97706 !important; }
.text-white          { color: #fff !important; }
.text-dark           { color: var(--sp-dark) !important; }
.text-warning-emphasis { color: #92400e !important; }

/* ---------- Divider ---------- */
.divider-text {
    display: flex; align-items: center; text-align: center;
    color: var(--sp-gray); font-size: 0.85rem; font-weight: 600; margin: 0.75rem 0;
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; border-bottom: 1px solid var(--sp-border); }
.divider-text::before { margin-right: 12px; }
.divider-text::after  { margin-left: 12px; }

/* ---------- Misc ---------- */
.letter-spacing { letter-spacing: 0.08em; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.user-select-none { user-select: none; }
.cursor-default { cursor: default; }
.pointer-events-none { pointer-events: none; }
.login-logo { height: 140px; width: auto; object-fit: contain; }
.text-break { word-break: break-all; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fst-italic { font-style: italic; }
.fw-800 { font-weight: 800 !important; }
.font-monospace { font-family: 'Courier New', monospace; }
.border-top-warning { border-top: 3px solid #fbbf24 !important; }

.spinner-border-sm {
    display: inline-block; width: 0.85rem; height: 0.85rem;
    border: 2px solid rgba(0,0,0,0.15); border-top-color: currentColor;
    border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -0.125em;
}
@keyframes spin { to { transform: rotate(360deg); } }

.border-danger { border: 2px solid #dc2626 !important; }
.border-0 { border: none !important; }
.bg-light { background: #f3f4f6; }

/* ---------- Error pages ---------- */
.error-emoji  { font-size: 6rem; display: inline-block; }
.error-code   { font-size: 7rem; font-weight: 900; color: var(--sp-red); line-height: 1; letter-spacing: -0.05em; font-family: 'Oswald', sans-serif; }
.skid-marks   { font-size: 2rem; letter-spacing: 0.4em; color: #999; }
.blame-box    { background: #1a1a1a; color: #00ff41; font-family: 'Courier New', monospace; font-size: 0.8rem; border-radius: 8px; padding: 1rem 1.5rem; text-align: left; max-height: 120px; overflow: hidden; position: relative; }
.blame-box::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 40px; background: linear-gradient(transparent, #1a1a1a); }

@keyframes drift  { 0%, 100% { transform: translateX(-8px); } 50% { transform: translateX(8px); } }
@keyframes wobble { 0%, 100% { transform: rotate(-5deg); }   50% { transform: rotate(5deg); } }
