/* ============================================
   Volta que Ganha - Design System
   Dark theme + Amber accent (#ff8800)
   ============================================ */

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

:root {
    --amber: #ff8800;
    --amber-light: #ffaa33;
    --amber-dark: #cc6d00;
    --amber-glow: rgba(255, 136, 0, 0.15);
    --green: #00c853;
    --red: #ff4444;
    --blue: #00b4d8;
    --bg: #0a0a0a;
    --bg-card: #111111;
    --bg-elevated: #1a1a1a;
    --bg-input: #151515;
    --border: #222222;
    --border-light: #333333;
    --text: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-amber: 0 4px 24px rgba(255, 136, 0, 0.2);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-light); }

/* ============================================
   Typography
   ============================================ */

h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.15; }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

.text-amber { color: var(--amber); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-green { color: var(--green); }
.text-center { text-align: center; }

.gradient-text {
    background: linear-gradient(135deg, var(--amber), var(--amber-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Layout
   ============================================ */

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 600px; margin: 0 auto; padding: 0 20px; }
.section { padding: 80px 0; }
.section-sm { padding: 40px 0; }

/* ============================================
   Navbar
   ============================================ */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.navbar-brand .brand-icon { font-size: 24px; }

.navbar-brand .brand-logo {
    height: 44px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
}

.navbar-nav { display: flex; align-items: center; gap: 16px; }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--border);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--amber), var(--amber-dark));
    color: #000;
    box-shadow: var(--shadow-amber);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 30px rgba(255, 136, 0, 0.3); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }

.btn-outline {
    background: transparent;
    color: var(--amber);
    border: 1px solid var(--amber);
}
.btn-outline:hover:not(:disabled) { background: var(--amber-glow); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text); }

.btn-danger {
    background: rgba(255, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(255, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(255, 68, 68, 0.25); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-block { width: 100%; }

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-elevated {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card-amber {
    background: var(--bg-card);
    border: 2px solid var(--amber);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-amber);
}

/* ============================================
   Forms
   ============================================ */

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-glow);
}

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

.form-input-lg {
    padding: 16px 20px;
    font-size: 18px;
    text-align: center;
    letter-spacing: 2px;
}

/* ============================================
   Stamp Card Visual
   ============================================ */

.stamp-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}

.stamp-slot {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px dashed var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--bg-input);
    transition: all 0.3s;
}

.stamp-slot.filled {
    border: 2px solid var(--amber);
    background: var(--amber-glow);
    animation: stampIn 0.3s ease-out;
}

.stamp-slot.reward {
    border: 2px solid var(--green);
    background: rgba(0, 200, 83, 0.15);
    font-size: 20px;
}

@keyframes stampIn {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   Stats
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--amber);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ============================================
   Modal
   ============================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-backdrop.active { display: flex; }

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* ============================================
   Badge / Tag
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-amber { background: var(--amber-glow); color: var(--amber); }
.badge-green { background: rgba(0, 200, 83, 0.15); color: var(--green); }
.badge-blue { background: rgba(0, 180, 216, 0.15); color: var(--blue); }

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; margin-bottom: 24px; }

/* ============================================
   Toast
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--amber); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Loading
   ============================================ */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading-overlay.hidden { opacity: 0; pointer-events: none; }

/* ============================================
   QR Code
   ============================================ */

.qr-container {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius);
    display: inline-block;
}

.qr-print {
    text-align: center;
    padding: 40px;
}

.qr-print .business-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #000;
}

.qr-print .reward-text {
    font-size: 16px;
    color: #555;
    margin-bottom: 20px;
}

.qr-print .scan-text {
    font-size: 14px;
    color: #888;
    margin-top: 16px;
}

/* ============================================
   Phone Input
   ============================================ */

.phone-input-wrapper {
    position: relative;
}

.phone-input-wrapper .phone-prefix {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.phone-input-wrapper .form-input {
    padding-left: 48px;
}

/* ============================================
   Table
   ============================================ */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; }
th { background: var(--bg-input); font-size: 12px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
td { border-top: 1px solid var(--border); font-size: 14px; }
tr:hover td { background: rgba(255, 136, 0, 0.03); }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    .section { padding: 50px 0; }
    .navbar { padding: 12px 16px; }
    .stamp-grid { gap: 8px; max-width: 280px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .modal { padding: 24px; }
}

@media (max-width: 414px) {
    h1 { font-size: 1.75rem; }
    .container { padding: 0 16px; }
    .stamp-grid { max-width: 250px; gap: 6px; }
    .btn-lg { padding: 14px 24px; font-size: 15px; }
}

/* ============================================
   Print Styles (for QR code)
   ============================================ */

@media print {
    body { background: #fff; color: #000; }
    .navbar, .toast-container, .no-print { display: none !important; }
    .qr-print { padding: 20px; }
}
