/* ═══════════════════════════════════════════
   TennisConnect Component Styles
   Terra Cotta Design System
   ═══════════════════════════════════════════ */

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-top: 0.25rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.2;
}

/* ── Cards ── */
.tc-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 0 0 1px var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.tc-card .res-court {
    flex: 1 1 100%;
}

/* ── Segmented Control ── */
.seg-control {
    display: flex;
    background: var(--muted);
    border-radius: 2rem;
    padding: 3px;
    gap: 2px;
}

.seg-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted-fg);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.seg-btn.active {
    background: var(--primary);
    color: var(--primary-fg);
}

.seg-count {
    background: rgba(255,255,255,0.3);
    color: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 1rem;
    min-width: 18px;
    text-align: center;
}

/* ── Skill Badge (FFT Ranking) ── */
.skill-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 2rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Beginner (NC / 40+) */
.skill-badge.skill-nc,
.skill-badge.skill-40,
.skill-badge.skill-30_5,
.skill-badge.skill-beginner {
    background: #2a3a4a;
    color: #8fa3ba;
}

/* Intermediate (30) */
.skill-badge.skill-30,
.skill-badge.skill-intermediate {
    background: #0d2d1a;
    color: #4ade80;
}

/* Advanced (15-25) */
.skill-badge.skill-25,
.skill-badge.skill-15,
.skill-badge.skill-advanced {
    background: #0d1f3c;
    color: #60a5fa;
}

/* Expert (<15) */
.skill-badge.skill-10,
.skill-badge.skill-5,
.skill-badge.skill-2_6,
.skill-badge.skill-expert {
    background: oklch(0.65 0.15 45 / 0.15);
    color: var(--primary-dark);
}

/* Large variant for Profile page */
.skill-badge.skill-badge-lg {
    font-size: 0.85rem;
    padding: 4px 14px;
}

/* ── Reservation Card specifics ── */
.res-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
}

.res-court {
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.3;
}

.res-address {
    font-size: 0.8rem;
    color: var(--muted-fg);
    margin: 0 0 0.4rem;
    width: 100%;
}

.res-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--muted-fg);
    width: 100%;
    flex-wrap: wrap;
}

.res-date { font-weight: 600; color: var(--foreground); }
.res-time { color: var(--primary); font-weight: 600; }
.res-players { color: var(--muted-fg); }

.res-owner {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.owner-label {
    font-size: 0.78rem;
    color: var(--muted-fg);
}

.res-card-header-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.res-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
}

.res-confirm {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
}

/* ── Visibility Badge ── */
.vis-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 2rem;
    white-space: nowrap;
}

.vis-public    { background: #0d2d1a; color: #4ade80; }
.vis-friends   { background: #0d1f3c; color: #60a5fa; }
.vis-private   { background: #2a3a4a; color: #8fa3ba; }

/* ── Join Status Badges ── */
.join-status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 2rem;
    display: inline-block;
}

.join-status-badge.pending  { background: #2d2200; color: #fbbf24; }
.join-status-badge.accepted { background: #0d2d1a; color: #4ade80; }
.join-status-badge.declined { background: #2d0f0f; color: #f87171; }

/* ── Pending Banner ── */
.pending-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: oklch(0.65 0.15 45 / 0.15);
    border: 1px solid oklch(0.65 0.15 45 / 0.40);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.55rem 0.9rem;
    border-radius: 0.75rem;
    cursor: pointer;
    width: 100%;
}

.pending-chevron { font-size: 0.7rem; }

/* ── Join Request Row ── */
.join-req-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    width: 100%;
}

.join-req-name { font-weight: 600; color: var(--foreground); }
.join-req-msg  { color: var(--muted-fg); font-style: italic; flex: 1 1 100%; }

/* ── Friend Card ── */
.tc-card .friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: oklch(0.65 0.15 45 / 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.friend-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-username {
    font-size: 0.75rem;
    color: var(--muted-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.request-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ── Status Badges (Friends) ── */
.status-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 2rem;
    border: 1px solid;
    opacity: 0.75;
}

.status-badge.status-friends { border-color: #22c55e; color: #4ade80; }
.status-badge.status-pending { border-color: #2a3a55; color: #7a8ba8; }

/* ── Search Bar ── */
.search-bar {
    display: flex;
    align-items: center;
}

.search-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.875rem;
    background: var(--card);
    color: var(--foreground);
    outline: none;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px oklch(0.65 0.15 45 / 0.15);
}

/* ── Profile ── */
.tc-card .profile-field {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--foreground);
}

.tc-card .profile-label {
    color: var(--muted-fg);
    font-size: 0.8rem;
}

.level-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.level-option {
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--muted-fg);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.15s;
}

.level-option.active,
.level-option:hover {
    border-color: var(--primary);
    background: oklch(0.65 0.15 45 / 0.1);
    color: var(--primary);
}

/* ── Buttons ── */
.btn-primary {
    background: var(--primary);
    color: var(--primary-fg);
    border: none;
    border-radius: 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    min-height: 32px;
    white-space: nowrap;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary.w-full {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    border-radius: 0.75rem;
    min-height: 44px;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 32px;
    white-space: nowrap;
}

.btn-outline-primary:hover { background: oklch(0.65 0.15 45 / 0.08); }

.btn-ghost {
    background: transparent;
    color: var(--muted-fg);
    border: 1.5px solid var(--border);
    border-radius: 0.6rem;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 32px;
    white-space: nowrap;
}

.btn-ghost:hover { background: var(--muted); }

.btn-danger {
    background: var(--destructive);
    color: #fff;
    border: none;
    border-radius: 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: opacity 0.15s;
    min-height: 32px;
    white-space: nowrap;
}

.btn-danger:hover { opacity: 0.85; }

.btn-outline-danger {
    background: transparent;
    color: var(--destructive);
    border: 1.5px solid var(--destructive);
    border-radius: 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 32px;
    white-space: nowrap;
}

.btn-outline-danger:hover { background: oklch(0.55 0.2 25 / 0.07); }

.btn-accept {
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    min-height: 32px;
    white-space: nowrap;
}

.btn-accept:hover { background: #15803d; }

.btn-decline {
    background: transparent;
    color: var(--destructive);
    border: 1.5px solid var(--destructive);
    border-radius: 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    min-height: 32px;
    white-space: nowrap;
}

/* ── FAB (inline in page header) ── */
.fab-inline {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-fg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px oklch(0.65 0.15 45 / 0.4);
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.fab-inline:hover  { background: var(--primary-dark); transform: scale(1.05); }
.fab-inline:active { transform: scale(0.95); }

/* ── Map button ── */
.btn-map-icon {
    background: var(--muted);
    border: none;
    border-radius: 0.5rem;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--muted-fg);
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

.btn-map-icon:hover { background: var(--accent); color: var(--foreground); }

/* ── Auth pages ── */
.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
    padding-top: 1rem;
}

.auth-logo {
    margin-bottom: 0.75rem;
}

.auth-logo img {
    width: 4rem;
    height: 4rem;
    object-fit: contain;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--foreground);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--muted-fg);
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover { text-decoration: underline; }

/* ── Form elements ── */
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted-fg);
    margin-bottom: 0.3rem;
}

.form-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.875rem;
    background: var(--card);
    color: var(--foreground);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px oklch(0.65 0.15 45 / 0.15);
}

/* ── Alerts ── */
.alert-error {
    background: #2d0f0f;
    border: 1px solid #7f1d1d;
    color: #f87171;
    border-radius: 0.75rem;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #0d2d1a;
    border: 1px solid #14532d;
    color: #4ade80;
    border-radius: 0.75rem;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
}

/* ── Empty / loading states ── */
.loading-text {
    color: var(--muted-fg);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 2rem;
}

/* ── Courts page specifics (panel detail) ── */
.court-detail {
    position: absolute;
    bottom: calc(var(--nav-height) + 1rem);
    left: 1rem;
    right: 1rem;
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    z-index: 20;
    max-width: 420px;
    margin: 0 auto;
}

.detail-close {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--muted-fg);
    line-height: 1;
}

.detail-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 0.25rem;
    padding-right: 1.5rem;
}

.detail-address {
    font-size: 0.8rem;
    color: var(--muted-fg);
    margin-bottom: 0.75rem;
}

.btn-reserve {
    width: 100%;
    background: var(--primary);
    color: var(--primary-fg);
    border: none;
    border-radius: 0.75rem;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-reserve:hover { background: var(--primary-dark); }

/* ── Courts map overlay ── */
.map-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    font-size: 0.875rem;
    color: var(--muted-fg);
    z-index: 20;
    pointer-events: none;
}

.map-error { color: var(--destructive); }

/* ── FAB add court / pending ── */
.fab-add-court {
    position: absolute;
    bottom: calc(var(--nav-height) + 4.5rem);
    right: 1rem;
    z-index: 20;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-fg);
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px oklch(0.65 0.15 45 / 0.45);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.fab-add-court:hover  { background: var(--primary-dark); transform: scale(1.05); }
.fab-add-court:active { transform: scale(0.95); }

.fab-pending-courts {
    position: absolute;
    bottom: calc(var(--nav-height) + 7.5rem);
    right: 1rem;
    z-index: 20;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--card);
    border: 1.5px solid var(--border);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    position: relative;
}

.fab-pending-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: var(--primary-fg);
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Form Select ── */
.form-select {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.875rem;
    background: var(--card);
    color: var(--foreground);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px oklch(0.65 0.15 45 / 0.15);
}

/* Ensure <option> elements inherit the dark background in supporting browsers */
.form-select option {
    background: var(--card);
    color: var(--foreground);
}

/* ── Modal form elements – ensure dark theme in all modals ── */
.modal-sheet-body input,
.modal-sheet-body select,
.modal-sheet-body textarea {
    background: var(--card);
    color: var(--foreground);
    border-color: var(--border);
    caret-color: var(--foreground);
}

.modal-sheet-body input::placeholder,
.modal-sheet-body textarea::placeholder {
    color: var(--muted-fg);
}

.modal-sheet-body label {
    color: var(--muted-fg);
}

/* ── App version footer ── */
.app-version {
    text-align: center;
    font-size: 0.7rem;
    color: var(--muted-fg);
    opacity: 0.5;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
}
