/* CHILL CLUB — brand styles */
:root {
    --brand-blue: #0033CC;
    --brand-blue-dark: #002599;
    --brand-blue-light: #E6EBFA;
    --bg-white: #FFFFFF;
    --text-dark: #1A1A1A;
    --text-soft: #666666;
    --border: #E0E0E0;

    /* Level colors */
    --lv1: #4CAF50;
    --lv2: #2196F3;
    --lv3: #9C27B0;
    --lv4: #E53935;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Calibri, sans-serif;
    background: var(--bg-white);
    color: var(--text-dark);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ----- Header ----- */
.app-header {
    text-align: center;
    padding: 32px 0 24px;
}
.brand-logo {
    font-size: 32px;
    font-weight: 800;
    color: var(--brand-blue);
    letter-spacing: -0.5px;
}
.brand-tagline {
    font-size: 14px;
    color: var(--text-soft);
    margin-top: 4px;
}

/* ----- Buttons ----- */
.btn {
    display: inline-block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    text-decoration: none;
}
.btn-primary {
    background: var(--brand-blue);
    color: white;
}
.btn-primary:hover { background: var(--brand-blue-dark); }
.btn-primary:disabled { background: #B0B0B0; cursor: not-allowed; }
.btn-secondary {
    background: var(--brand-blue-light);
    color: var(--brand-blue);
}
.btn-ghost {
    background: transparent;
    color: var(--brand-blue);
    border: 1px solid var(--brand-blue);
}

/* ----- Form ----- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-dark);
}
.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    transition: border 0.15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--brand-blue);
}
.form-hint {
    font-size: 13px;
    color: var(--text-soft);
    margin-top: 4px;
}
.form-error {
    color: #C0392B;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}
.form-error.show { display: block; }

/* OTP boxes — 6 ô */
.otp-boxes {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin: 20px 0;
}
.otp-box {
    width: 48px;
    height: 56px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.otp-box:focus { outline: none; border-color: var(--brand-blue); }

/* ----- Dashboard ----- */
.member-card {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
}
.member-greeting {
    font-size: 14px;
    opacity: 0.9;
}
.member-name {
    font-size: 22px;
    font-weight: 700;
    margin-top: 4px;
}
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    margin-top: 12px;
}
.points-row {
    display: flex;
    gap: 16px;
    margin-top: 20px;
}
.points-stat { flex: 1; }
.points-label {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.85;
    letter-spacing: 0.5px;
}
.points-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}
.progress-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.2);
}
.progress-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
}
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: white;
    border-radius: 999px;
    transition: width 0.5s;
}

/* ----- Section ----- */
.section { margin-top: 28px; }
.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-dark);
}

/* ----- Reward grid ----- */
.reward-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.reward-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.reward-card:hover { border-color: var(--brand-blue); }
.reward-card.locked { opacity: 0.5; cursor: not-allowed; }
.reward-card.affordable { border-color: var(--brand-blue); background: var(--brand-blue-light); }
.reward-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.reward-cost {
    margin-top: 8px;
    font-size: 13px;
    color: var(--brand-blue);
    font-weight: 700;
}
.reward-meta {
    font-size: 11px;
    color: var(--text-soft);
    margin-top: 4px;
}

/* ----- History ----- */
.history-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.history-item:last-child { border-bottom: none; }
.history-delta.positive { color: var(--lv1); font-weight: 600; }
.history-delta.negative { color: var(--lv4); font-weight: 600; }
.history-reason {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 2px;
}

/* ----- Helpers ----- */
.center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.text-soft { color: var(--text-soft); }
.text-small { font-size: 13px; }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--brand-blue-light);
    border-top-color: var(--brand-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 440px;
    margin: 0 auto;
    background: var(--text-dark);
    color: white;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    transform: translateY(120%);
    transition: transform 0.25s;
    z-index: 99;
}
.toast.show { transform: translateY(0); }
