/* ═══════════════════════════════════════════════════════════════
   RPM Kiosk — Check-In Terminal CSS
   Touch-optimized, dark theme matching RPM design system
   ═══════════════════════════════════════════════════════════════ */

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

:root {
    --bg-deep: #050505;
    --bg-primary: #0A0A0A;
    --bg-elevated: #121212;
    --bg-card: #1A1A1A;
    --bg-card-hover: #222222;
    --bg-surface: #1E1E2E;
    --border: #2A2A2A;
    --border-subtle: #1E1E1E;

    --text-primary: #E8E8E8;
    --text-secondary: #A0A0A0;
    --text-muted: #666666;

    --crimson: #C30B0B;
    --crimson-glow: #E01515;
    --crimson-dark: #8B0000;
    --gold: #D4AF37;
    --gold-glow: #E8C84A;
    --gold-dark: #A08520;

    --green: #22C55E;
    --green-dark: #16A34A;
    --green-glow: rgba(34, 197, 94, 0.25);

    --yellow: #EAB308;
    --yellow-bg: rgba(234, 179, 8, 0.1);

    --glass-bg: rgba(26, 26, 26, 0.7);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-blur: 20px;

    --font-heading: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ── HEADER ── */
.kiosk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kiosk-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.header-title {
    display: flex;
    flex-direction: column;
}

.kiosk-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kiosk-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.kiosk-time {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: -0.02em;
}

/* ── CLASS BANNER ── */
.class-banner {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.class-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.1rem;
}

.class-banner.no-class {
    border-bottom-color: var(--border-subtle);
}

.class-active-name {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.class-time-range {
    color: var(--text-secondary);
    font-size: 1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-free {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-open-rope {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.badge-paid {
    background: rgba(195, 11, 11, 0.15);
    color: var(--crimson-glow);
    border: 1px solid rgba(195, 11, 11, 0.3);
}

.register-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--green);
    color: #000;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.next-class-info {
    text-align: center;
    color: var(--text-secondary);
}

.next-class-info strong {
    color: var(--text-primary);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── MAIN ── */
.kiosk-main {
    display: flex;
    justify-content: center;
    padding: 2rem 1.5rem 3rem;
    min-height: calc(100vh - 180px);
}

/* ── STATES ── */
.kiosk-state {
    display: none;
    width: 100%;
    max-width: 700px;
    animation: fadeIn 0.3s ease;
}

.kiosk-state.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── GLASS CARD ── */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

/* ── STATE TITLES ── */
.state-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

.state-title span {
    color: var(--gold);
}

.state-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* ── SEARCH ── */
.search-card {
    padding: 2.5rem 2rem;
}

.search-wrap {
    position: relative;
    margin-bottom: 0.5rem;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    pointer-events: none;
}

.kiosk-input {
    width: 100%;
    padding: 1.2rem 1.2rem 1.2rem 3.5rem;
    font-size: 1.3rem;
    font-family: var(--font-body);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-base);
}

.kiosk-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

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

.pin-wrap .kiosk-input {
    padding-left: 1.2rem;
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.2em;
}

/* ── SEARCH RESULTS ── */
.search-results {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.search-results.open {
    max-height: 500px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 60px;
}

.search-result-item:hover,
.search-result-item:active {
    background: var(--bg-card-hover);
    border-color: var(--gold-dark);
    transform: scale(1.01);
}

.result-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--crimson-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
}

.result-name {
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.result-username {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* ── NO ACCOUNT ── */
.no-account-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
    font-size: 1rem;
    display: none;
}

.no-account-msg.show {
    display: block;
}

/* ── BUTTONS ── */
.kiosk-btn {
    display: block;
    width: 100%;
    padding: 1.2rem 2rem;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    margin-top: 1.5rem;
    letter-spacing: 0.02em;
}

.kiosk-btn:active {
    transform: scale(0.97);
}

.kiosk-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--crimson);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--crimson-glow);
    box-shadow: 0 0 25px rgba(195, 11, 11, 0.3);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #000;
}

.btn-gold:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--gold), var(--gold-glow));
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.3);
}

.btn-checkin {
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    color: #000;
    font-size: 1.5rem;
    padding: 1.4rem 2rem;
}

.btn-checkin:hover:not(:disabled) {
    box-shadow: 0 0 30px var(--green-glow);
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color var(--transition-fast);
}

.back-btn:hover {
    color: var(--text-primary);
}

/* ── LOGIN ── */
.login-card {
    padding: 2.5rem 2rem;
}

.login-error {
    color: var(--crimson-glow);
    text-align: center;
    font-size: 1rem;
    min-height: 1.5rem;
    margin-top: 0.5rem;
}

/* ── FORM ── */
.form-card {
    padding: 2rem;
}

.welcome-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.welcome-header .state-title {
    margin-bottom: 0;
    text-align: left;
    font-size: 1.6rem;
}

.balance-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.5rem 1rem;
}

.balance-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.balance-value {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
}

.balance-unit {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-label {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.class-info-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.class-info-box .class-active-name {
    font-size: 1.2rem;
}

/* ── TOGGLE GROUP ── */
.toggle-group {
    display: flex;
    gap: 0.75rem;
}

.toggle-btn {
    flex: 1;
    padding: 1rem;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 60px;
}

.toggle-btn:active {
    transform: scale(0.97);
}

.toggle-btn.selected {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
}

/* ── TOGGLE SWITCH (checkbox) ── */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-primary);
    min-height: 60px;
}

.toggle-switch {
    position: relative;
    width: 56px;
    height: 30px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: var(--transition-base);
    cursor: pointer;
}

.toggle-switch .slider::before {
    content: '';
    position: absolute;
    left: 3px;
    bottom: 3px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition-base);
}

.toggle-switch input:checked + .slider {
    background: var(--gold);
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(26px);
}

/* ── PARTNER ── */
.partner-add-area {
    margin-top: 1rem;
}

.partner-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.partner-chip-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.05rem;
}

.partner-chip-pay {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.partner-chip-pay input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--gold);
    cursor: pointer;
}

.partner-chip-remove {
    background: none;
    border: none;
    color: var(--crimson);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.partner-search-wrap {
    position: relative;
    margin-top: 0.5rem;
}

.input-sm {
    padding: 0.8rem 1rem;
    font-size: 1.05rem;
}

.partner-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 50;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
}

.partner-results .search-result-item {
    margin-top: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    min-height: 50px;
    padding: 0.75rem 1rem;
}

.partner-results .search-result-item:last-child {
    border-bottom: none;
}

/* ── SUMMARY ── */
.summary-card {
    padding: 2rem;
}

.summary-items {
    margin-bottom: 1.5rem;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 1.1rem;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-row-who {
    font-weight: 600;
}

.summary-row-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.summary-row-cost {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--gold);
}

.summary-row-cost.free {
    color: var(--green);
}

.summary-row-cost.pays-own {
    color: var(--text-muted);
    font-weight: 400;
    font-style: italic;
}

.summary-total {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}

.summary-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

.summary-total-row + .summary-total-row {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

.summary-total-label {
    color: var(--text-secondary);
}

.summary-total-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
}

.summary-total-value.gold {
    color: var(--gold);
}

.cash-warning {
    background: var(--yellow-bg);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    text-align: center;
    color: var(--yellow);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ── DONE ── */
.done-card {
    text-align: center;
    padding: 3rem 2rem;
}

.done-check {
    margin-bottom: 1.5rem;
}

.check-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--green);
    font-size: 3rem;
    color: #000;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 50px var(--green-glow);
}

@keyframes popIn {
    0%   { transform: scale(0); opacity: 0; }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.done-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--green);
    margin-bottom: 1rem;
}

.done-balance {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.done-balance strong {
    color: var(--gold);
    font-family: var(--font-heading);
}

.done-cash {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--yellow);
    padding: 0.75rem 1.5rem;
    background: var(--yellow-bg);
    border-radius: var(--radius-md);
    display: inline-block;
    margin-bottom: 1rem;
}

.done-timer {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
}

.done-timer span {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ── OPEN ROPE SPECIAL STYLING ── */
.open-rope-banner {
    border-left: 4px solid var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

.base-basics-banner {
    border-left: 4px solid var(--green);
    background: rgba(34, 197, 94, 0.05);
}

/* ── RESPONSIVE — Tablet optimized ── */
@media (max-width: 768px) {
    html { font-size: 16px; }

    .kiosk-header {
        padding: 0.75rem 1rem;
    }

    .kiosk-logo {
        width: 40px;
        height: 40px;
    }

    .kiosk-brand { font-size: 1.25rem; }
    .kiosk-time { font-size: 2rem; }

    .kiosk-main {
        padding: 1.5rem 1rem 2rem;
    }

    .glass-card {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
    }

    .state-title { font-size: 1.6rem; }

    .welcome-header {
        flex-direction: column;
        align-items: stretch;
    }

    .welcome-header .state-title {
        text-align: center;
    }

    .balance-pill {
        justify-content: center;
    }
}

@media (min-width: 1024px) {
    html { font-size: 20px; }

    .kiosk-main {
        padding: 3rem 2rem;
    }

    .kiosk-state {
        max-width: 800px;
    }
}

/* ── LOADING OVERLAY ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 5, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
}
