/* portal.css — Portal do Cliente 67food */

:root {
    --primary:      #FF6B35;
    /* Botão sempre usa tom escuro — não depende de --primary para garantir contraste */
    --btn-bg:       #1a1a1a;
    --btn-bg-hover: #333333;
    --bg:           #F3F4F6;
    --card:         #FFFFFF;
    --text:         #111827;
    --muted:        #6B7280;
    --border:       #E5E7EB;
    --radius:       12px;
    --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100dvh;
}

/* ── Auth page ────────────────────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    min-height: 100dvh;
}

.auth-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
}

.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon { font-size: 48px; margin-bottom: 8px; }
.auth-store-name { font-size: 22px; font-weight: 700; color: var(--text); }
.auth-subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }

.step-label { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.dashboard-page {
    padding-bottom: 72px; /* tab bar height */
}

.dash-header {
    /* Header sempre escuro para garantir contraste independente da cor da loja */
    background: var(--btn-bg);
    color: #fff;
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dash-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.dash-store-name { font-weight: 700; font-size: 16px; }
.dash-welcome    { font-size: 13px; opacity: .85; }

.btn-logout {
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    padding: 6px 10px;
    cursor: pointer;
}

/* Tab bar */
.tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    z-index: 20;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    gap: 3px;
    transition: color .15s;
}
.tab-btn.active { color: var(--btn-bg); font-weight: 700; }
.tab-icon { font-size: 20px; }
.tab-label { font-size: 11px; font-weight: 500; }

.dash-main {
    padding: 12px 12px 0;
    max-width: 600px;
    margin: 0 auto;
}

.tab-content { display: block; }
.tab-content.hidden { display: none; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.order-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: box-shadow .15s;
}
.order-card:active { box-shadow: var(--shadow-md); }
.order-card.order-active { border-left-color: var(--primary); }

.order-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.order-num { font-weight: 700; font-size: 15px; }
.order-card-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
    flex-wrap: wrap;
}
.order-total { font-weight: 600; color: var(--text); margin-left: auto; }

/* Status badge */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge.large { font-size: 14px; padding: 5px 14px; }

/* Active orders banner */
.active-banner {
    background: #ECFDF5;
    color: #065F46;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #A7F3D0;
}

/* ── Missions ─────────────────────────────────────────────────────────────── */
.mission-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 10px;
}
.mission-card.mission-done { opacity: .7; }
.mission-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.mission-icon { font-size: 28px; flex-shrink: 0; }
.mission-info { flex: 1; }
.mission-title { font-weight: 600; font-size: 15px; }
.mission-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.mission-check { color: #10B981; font-size: 20px; font-weight: 700; }

.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.progress-label { font-size: 12px; color: var(--muted); text-align: right; }
.coupon-badge { margin-top: 8px; font-size: 13px; background: #FEF9C3; color: #92400E; padding: 6px 12px; border-radius: 8px; display: inline-block; }

/* ── Games ────────────────────────────────────────────────────────────────── */
.game-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.game-type { font-weight: 600; min-width: 90px; }
.game-date { color: var(--muted); font-size: 13px; }
.game-prize { color: #065F46; font-size: 13px; margin-left: auto; }
.game-noPrize { color: var(--muted); font-size: 13px; margin-left: auto; }
.coupon-code { font-weight: 700; letter-spacing: .05em; }

/* ── Fidelidade ───────────────────────────────────────────────────────────── */
.nivel-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 12px;
    border: 3px solid var(--primary);
    text-align: center;
}
.nivel-icon { font-size: 40px; display: block; margin-bottom: 6px; }
.nivel-nome { font-size: 18px; font-weight: 700; }

.loyalty-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.loyalty-box {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    text-align: center;
}
.loyalty-val { font-size: 22px; font-weight: 700; color: var(--text); }
.loyalty-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    padding: 0;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-height: 85dvh;
    overflow-y: auto;
    padding: 0 0 24px;
    animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 16px;
    position: sticky;
    top: 0;
    background: var(--card);
}
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px; }

.detail-status { padding: 16px 20px 8px; }
.detail-row { display: flex; justify-content: space-between; padding: 4px 20px; font-size: 14px; color: var(--muted); }
.detail-addr { padding: 8px 20px; font-size: 14px; }
.detail-obs { padding: 8px 20px; font-size: 14px; color: var(--muted); }

.items-list { margin: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.item-row { padding: 10px 20px; border-bottom: 1px solid var(--border); }
.item-row:last-child { border-bottom: none; }
.item-info { display: flex; gap: 8px; align-items: baseline; }
.item-qty { font-weight: 700; color: var(--btn-bg); min-width: 24px; }
.item-name { font-weight: 500; flex: 1; }
.item-val { float: right; font-weight: 600; margin-top: -24px; }
.item-extras, .item-obs { font-size: 13px; color: var(--muted); margin-top: 3px; padding-left: 32px; }

.detail-totals { padding: 8px 20px 0; }
.total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; color: var(--muted); }
.total-final { font-weight: 700; font-size: 16px; color: var(--text); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* ── Forms & buttons ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--muted); }
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color .15s;
}
.form-input:focus { border-color: var(--primary); }
.otp-input { letter-spacing: .25em; text-align: center; font-size: 22px; font-weight: 700; }

.btn-primary {
    width: 100%;
    padding: 13px;
    background: var(--btn-bg);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    margin-bottom: 10px;
    /* Faixa colorida na esquerda usa a cor da loja como acento */
    border-left: 4px solid var(--primary);
}
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-primary:disabled, .btn-primary.loading { opacity: .5; cursor: not-allowed; }

.btn-link { background: none; border: none; color: var(--btn-bg); font-size: 14px; cursor: pointer; display: block; margin: 6px auto; text-decoration: underline; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination { margin: 8px 0 16px; }
.pag-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pag-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    cursor: pointer;
    font-size: 14px;
    transition: border-color .15s, color .15s;
}
.pag-btn.active { border-color: var(--btn-bg); color: var(--btn-bg); font-weight: 700; }

/* ── Alerts & states ──────────────────────────────────────────────────────── */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 12px;
}
.alert-error   { background: #FEF2F2; color: #991B1B; }
.alert-warn    { background: #FFFBEB; color: #92400E; }
.alert-success { background: #ECFDF5; color: #065F46; }

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
    font-size: 15px;
}

.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
