/* ==========================================================================
   Seyyahız Bileşenleri — butonlar, yüzeyler, form alanları
   tokens.css'teki değerleri kullanır; style.css'ten SONRA yüklenmeli.
   ========================================================================== */

/* Sayfa tabanı: koyu zemin html'de, body şeffaf kalır (harita katmanları arkada görünsün) */
html {
    background-color: var(--ink-100);
}

/* ==========================================================================
   Butonlar
   .btn + varyant: .btn-primary (ana aksiyon, turuncu) · .btn-secondary (turkuaz)
                   .btn-ghost (çerçeveli, şeffaf) · .btn-danger (kırmızı)
   Boyut: .btn-sm · .btn-large · .btn-full
   Kural: bir ekranda tek .btn-primary.
   ========================================================================== */
.btn {
    --btn-bg: transparent;
    --btn-shadow: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--btn-bg);
    box-shadow: var(--btn-shadow);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: var(--fs-16);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--dur-fast) var(--ease-spring),
                filter var(--dur-fast) ease,
                background-color var(--dur-fast) ease,
                border-color var(--dur-fast) ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.03);
}

.btn:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}

.btn:focus-visible {
    outline: 2px solid var(--cini-30);
    outline-offset: 3px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    cursor: not-allowed;
    filter: grayscale(0.8);
    opacity: 0.5;
}

/* Kabartma: üstte ince ışık, altta iç gölge, altında yumuşak düşen gölge */
.btn-primary,
.btn-secondary,
.btn-danger {
    --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28),
                  inset 0 -3px 0 rgba(0, 0, 0, 0.22),
                  0 6px 16px rgba(0, 0, 0, 0.3);
    padding-bottom: calc(0.65rem + 2px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-primary {
    --btn-bg: linear-gradient(180deg, var(--sun-30) 0%, var(--sun-70) 100%);
}

.btn-secondary {
    --btn-bg: linear-gradient(180deg, var(--cini-30) 0%, var(--cini-80) 100%);
}

.btn-danger {
    --btn-bg: linear-gradient(180deg, #f2686f 0%, #b52a35 100%);
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    filter: brightness(1.07);
}

.btn-ghost {
    --btn-bg: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn-ghost:hover:not(:disabled) {
    --btn-bg: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Çıkış/ayrılma gibi geri dönülmez ama ikincil eylemler */
.btn-ghost.is-danger {
    --btn-bg: rgb(239 68 68 / 0.1);
    border-color: rgb(239 68 68 / 0.4);
    color: #ff8a8a;
}

.btn-ghost.is-danger:hover:not(:disabled) {
    --btn-bg: var(--danger-50);
    border-color: var(--danger-50);
    color: #fff;
}

.btn svg {
    flex-shrink: 0;
}

.btn-sm {
    min-height: 36px;
    padding: 0.45rem 1rem;
    font-size: var(--fs-14);
}

.btn-large {
    min-height: 56px;
    padding: 1rem 2.25rem;
    font-size: var(--fs-18);
}

.btn-large.btn-primary,
.btn-large.btn-secondary,
.btn-large.btn-danger {
    padding-bottom: calc(1rem + 2px);
}

.btn-full {
    width: 100%;
    margin-top: 1rem;
}

/* "Hazır" vurgusu: gölgeyi bozmadan hafif nabız */
@keyframes pulseReady {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.025); }
}

.pulse-ready:not(:disabled) {
    animation: pulseReady 2.4s var(--ease-out) infinite;
}

.pulse-ready:hover:not(:disabled) {
    animation-play-state: paused;
}

/* ==========================================================================
   Yüzeyler
   .surface (panel/modal) · .surface-raised (panel içindeki kart)
   .surface-sunken (gömülü alan: değer kutusu, liste zemini)
   Derinlik blur ile değil, katman + iç ışık + gölge ile verilir.
   ========================================================================== */
.surface {
    background-color: rgb(var(--ink-90-rgb) / 0.92);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 120px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
                0 18px 40px rgba(0, 0, 0, 0.45);
}

.surface-raised {
    background-color: var(--ink-80);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
                0 4px 10px rgba(0, 0, 0, 0.3);
}

.surface-sunken {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    box-shadow: inset 0 6px 14px rgba(0, 0, 0, 0.25),
                0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Mevcut kart sınıfları yüzey diline bağlanır */
.glass-card {
    background-color: rgb(var(--ink-90-rgb) / 0.92);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 120px);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
                0 18px 40px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   Form alanları
   .input-group içindeki input/select/textarea veya tek başına .input / .select
   ========================================================================== */
.input,
.select,
.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: var(--fs-16);
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.input:focus,
.select:focus,
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.38);
    border-color: var(--cini-50);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 0 3px rgb(var(--cini-50-rgb) / 0.2);
}

.input::placeholder,
.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-faint);
}

.select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.5rem;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path d="M1 1l5 5 5-5" fill="none" stroke="%23a3aec2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    cursor: pointer;
}

.select option {
    background: var(--ink-90);
    color: var(--text-main);
}

/* Kod girişi (6 haneli lobi kodu) */
.input-code {
    text-align: center;
    font-size: var(--fs-24);
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

/* ==========================================================================
   Metin yardımcıları
   ========================================================================== */
.eyebrow {
    color: var(--text-muted);
    font-size: var(--fs-12);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: var(--lh-12);
    text-transform: uppercase;
}

.text-muted {
    color: var(--text-muted);
}

/* Navbar'da oda kodu */
.nav-room {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    margin-right: 0.5rem;
    line-height: 1;
}

.nav-room-code {
    font-weight: 700;
    letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums;
}

/* Yükleniyor göstergesi */
.spinner {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 4px solid rgb(var(--sun-50-rgb) / 0.2);
    border-top-color: var(--sun-50);
    animation: spin 0.9s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, 0.25); border-top-color: currentColor; }
.spinner-lg { width: 64px; height: 64px; border-width: 5px; }

@keyframes spin { to { transform: rotate(360deg); } }

.hint {
    color: var(--text-muted);
    font-size: var(--fs-12);
    line-height: var(--lh-12);
}

/* ==========================================================================
   Oda kurma sihirbazı & modallar
   ========================================================================== */
.modal-title {
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-size: var(--fs-30);
    font-weight: 800;
    line-height: var(--lh-30);
}

.modal-subtitle {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.modal-content.modal-sm { max-width: 400px; }
.modal-content.modal-md { max-width: 500px; }

.wizard-header {
    margin-bottom: 2rem;
    text-align: center;
}

.wizard-title {
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-size: var(--fs-20);
    font-weight: 700;
    line-height: var(--lh-20);
    text-align: center;
}

/* Büyük değer göstergesi (oyuncu sayısı, tur, dakika, km) */
.value-panel {
    margin: 1.5rem 0;
    padding: 2rem 1.5rem;
    text-align: center;
}

.value-panel-compact {
    flex: 1;
    margin: 0;
    padding: 1.5rem 1rem;
}

.value-panel .eyebrow {
    margin-bottom: 1rem;
}

.value-display {
    display: block;
    margin-bottom: 1.5rem;
    color: var(--sun-50);
    font-size: var(--fs-60);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color var(--dur-base) ease, transform var(--dur-fast) var(--ease-spring);
}

.value-panel-compact .value-display {
    margin-bottom: 1rem;
    font-size: var(--fs-48);
}

.value-display.is-cini {
    color: var(--cini-50);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.8rem;
    color: var(--text-muted);
    font-size: var(--fs-14);
    font-weight: 500;
}

.team-settings {
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

/* Etiket + anahtar satırı (Takımca Oyna) */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
}

.settings-row-label {
    color: var(--text-main);
    font-size: var(--fs-18);
    font-weight: 600;
    cursor: pointer;
}

.field-block {
    margin-top: 1.5rem;
}

.field-block .eyebrow {
    margin-bottom: 0.6rem;
    text-align: center;
}

.field-block .hint {
    margin-top: 0.5rem;
    text-align: center;
}

.wizard-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 480px) {
    .value-display { font-size: var(--fs-48); }
    .value-panel-compact .value-display { font-size: var(--fs-36); }
    .team-settings { gap: 0.75rem; }
}

/* ==========================================================================
   Mobil
   ========================================================================== */
@media (max-width: 640px) {
    /* Modal ekran kenarına yapışmasın */
    .modal-overlay {
        padding: 1rem;
    }

    .modal-overlay .glass-card {
        padding: 2rem 1.25rem 1.5rem;
    }

    /* Navbar'da butonlar tek satırda kalsın */
    .navbar .btn {
        min-height: 40px;
        padding: 0.5rem 1rem;
        font-size: var(--fs-14);
    }

    .navbar .btn-primary {
        padding-bottom: calc(0.5rem + 2px);
    }
}
