/* =============================================
   Adega Sul & Serra — CSS Global
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary:       #2C1A0E;
  --primary-light: #4A2E18;
  --accent:        #C8923A;
  --accent-dark:   #A67328;
  --cream:         #F5EFE0;
  --cream-dark:    #EDE4CE;
  --text:          #1A1008;
  --text-muted:    #6B5744;
  --success:       #2E7D32;
  --danger:        #C62828;
  --warning:       #E65100;
  --border:        #D9C9B0;
  --card-bg:       #FFFDF8;
  --shadow:        0 2px 16px rgba(44,26,14,.12);
  --radius:        14px;
  --radius-sm:     8px;
  --transition:    .18s ease;
}

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

html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }
a   { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

h1,h2,h3,h4 { font-family: 'Playfair Display', serif; color: var(--primary); line-height: 1.25; }

/* ---- HEADER ---- */
.site-header {
  background: var(--primary);
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.logo-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-icon { font-size: 28px; }
.logo-text  { font-family: 'Playfair Display', serif; color: #fff; font-size: 1.15rem; line-height: 1.2; }
.logo-sub   { font-size: .68rem; color: var(--accent); font-family: 'Inter', sans-serif; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.header-nav { display: flex; gap: 8px; }
.btn-nav {
  background: transparent; border: 1.5px solid rgba(255,255,255,.25);
  color: #fff; padding: 6px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.btn-nav:hover { background: rgba(255,255,255,.12); border-color: var(--accent); }
.btn-nav.accent { background: var(--accent); border-color: var(--accent); color: var(--primary); }
.btn-nav.accent:hover { background: var(--accent-dark); }

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #6B3A1F 100%);
  padding: 60px 20px;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C8923A' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; max-width: 640px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); color: #fff; margin-bottom: 12px; }
.hero p   { color: rgba(255,255,255,.75); font-size: 1.05rem; margin-bottom: 28px; }
.hero-icon { font-size: 3rem; margin-bottom: 16px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 24px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  cursor: pointer; border: none; transition: var(--transition); font-family: inherit;
}
.btn-primary   { background: var(--accent); color: var(--primary); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(200,146,58,.35); }
.btn-outline   { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: var(--primary); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn-success   { background: var(--success); color: #fff; }
.btn-full      { width: 100%; }
.btn:disabled  { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(44,26,14,.18); }
.card-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.card-body { padding: 16px 20px 20px; }
.card-title { font-size: 1.05rem; font-family: 'Playfair Display', serif; color: var(--primary); margin-bottom: 6px; }
.card-sub   { font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; }
.card-prize { display: flex; align-items: center; gap: 6px; background: var(--cream-dark); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; font-size: .88rem; font-weight: 600; color: var(--primary); }
.card-price { font-size: 1.2rem; font-weight: 700; color: var(--accent); }

/* Progress bar */
.progress-wrap { margin-top: 10px; }
.progress-label { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-bottom: 4px; }
.progress-bar  { height: 8px; background: var(--cream-dark); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); border-radius: 999px; transition: width .4s ease; }

/* ---- GRID ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section { padding: 48px 0; }
.section-title { font-size: 1.5rem; color: var(--primary); margin-bottom: 24px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, var(--border), transparent); }
.grid-rifas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }

/* ---- STATUS BADGE ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .73rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.badge-active   { background: #E8F5E9; color: var(--success); }
.badge-pending  { background: #FFF3E0; color: var(--warning); }
.badge-paid     { background: #E8F5E9; color: var(--success); }
.badge-canceled { background: #FCE4EC; color: var(--danger); }
.badge-drawn    { background: var(--cream-dark); color: var(--primary); }

/* ---- NUMBERS GRID ---- */
.numbers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
  max-height: 400px; overflow-y: auto;
  padding: 4px; margin: 12px 0;
}
.number-item { position: relative; }
.number-item input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.number-item label {
  display: flex; align-items: center; justify-content: center;
  height: 44px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  border: 2px solid transparent;
  user-select: none;
}
.number-item.status-available label { background: #E8F5E9; color: var(--success); border-color: #C8E6C9; }
.number-item.status-available label:hover { background: var(--accent); color: var(--primary); border-color: var(--accent); }
.number-item.status-available.is-selected label { background: var(--accent); color: var(--primary); border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(200,146,58,.3); }
.number-item.status-reserved label { background: #FFF3E0; color: var(--warning); border-color: #FFE0B2; cursor: not-allowed; }
.number-item.status-paid    label { background: #FCE4EC; color: var(--danger); border-color: #F8BBD9; cursor: not-allowed; }
.number-item.is-filter-hidden { display: none; }

/* ---- STICKY BAR ---- */
.sticky-reserve-bar-v67 {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--primary);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transform: translateY(100%); transition: transform .22s ease;
  box-shadow: 0 -4px 24px rgba(0,0,0,.3);
}
.sticky-reserve-bar-v67.is-visible { transform: translateY(0); }
.sticky-info { color: #fff; }
.sticky-count { font-size: 1rem; font-weight: 700; }
.sticky-label { font-size: .78rem; color: rgba(255,255,255,.6); }
.sticky-total { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(20,10,4,.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.modal-overlay.is-open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--card-bg); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  padding: 28px 24px; transform: translateY(40px); transition: transform .22s ease;
}
.modal-overlay.is-open .modal-box { transform: translateY(0); }
.modal-title { font-size: 1.25rem; margin-bottom: 20px; text-align: center; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); }

@media (min-width: 540px) {
  .modal-overlay { align-items: center; }
  .modal-box { border-radius: var(--radius); }
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: .92rem; color: var(--text);
  background: #fff; transition: border-color var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,146,58,.18); }
textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 16px; }
.alert-success { background: #E8F5E9; color: #1B5E20; border-left: 4px solid var(--success); }
.alert-danger  { background: #FCE4EC; color: #880E4F; border-left: 4px solid var(--danger); }
.alert-warning { background: #FFF3E0; color: #BF360C; border-left: 4px solid var(--warning); }
.alert-info    { background: #E3F2FD; color: #0D47A1; border-left: 4px solid #1565C0; }

/* ---- PIX BOX ---- */
.pix-box { text-align: center; padding: 24px; background: var(--cream-dark); border-radius: var(--radius); margin: 20px 0; }
.pix-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.pix-key-area { display: flex; gap: 8px; margin-bottom: 12px; }
.pix-key-input { flex: 1; font-family: monospace; font-size: .8rem; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.pix-timer { font-size: .85rem; color: var(--text-muted); }
.pix-timer span { font-weight: 700; color: var(--danger); }

/* ---- ADMIN SIDEBAR ---- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--primary);
  padding: 24px 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  overflow-y: auto;
  transform: translateX(-100%); transition: transform .22s ease;
}
.admin-sidebar.is-open { transform: translateX(0); }
@media (min-width: 900px) {
  .admin-sidebar { transform: translateX(0); }
  .admin-content { margin-left: 240px; }
}
.sidebar-logo { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px; }
.sidebar-logo-text { font-family: 'Playfair Display', serif; color: #fff; font-size: 1rem; }
.sidebar-logo-sub  { font-size: .72rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: rgba(255,255,255,.7);
  font-size: .88rem; font-weight: 500; transition: var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(200,146,58,.15); color: #fff; border-left: 3px solid var(--accent); }
.sidebar-nav a span { font-size: 1.1rem; }
.sidebar-section { padding: 8px 20px 4px; font-size: .7rem; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .08em; margin-top: 8px; }
.admin-content { flex: 1; padding: 28px 24px; max-width: 1100px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.admin-title { font-size: 1.5rem; }
.admin-toggle { display: flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; border: none; width: 40px; height: 40px; border-radius: var(--radius-sm); cursor: pointer; font-size: 1.2rem; }
@media (min-width: 900px) { .admin-toggle { display: none; } }

/* ---- STAT CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-icon  { font-size: 1.5rem; margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: 700; font-family: 'Playfair Display', serif; color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--text-muted); }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--card-bg); }
thead tr { background: var(--primary); }
thead th { color: rgba(255,255,255,.85); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 12px 16px; text-align: left; }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: var(--cream); }
tbody td { padding: 12px 16px; font-size: .88rem; color: var(--text); }

/* ---- LOGIN PAGE ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary) 0%, #6B3A1F 100%); padding: 20px; }
.login-card { background: var(--card-bg); border-radius: var(--radius); padding: 40px 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 3rem; }
.login-brand { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--primary); }
.login-sub   { font-size: .82rem; color: var(--text-muted); }

/* ---- GALLERY CAROUSEL ---- */
.gallery-wrap { position: relative; border-radius: var(--radius); overflow: hidden; }
.gallery-track { display: flex; overflow-x: hidden; scroll-snap-type: x mandatory; }
.detail-gallery-slide { flex: 0 0 100%; scroll-snap-align: start; }
.detail-gallery-slide img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.gallery-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.5); color: #fff; border: none;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.gallery-btn:hover { background: var(--accent); color: var(--primary); }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.gallery-counter { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: .75rem; padding: 3px 10px; border-radius: 999px; }

/* ---- FILTER TABS ---- */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-tab { padding: 5px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; font-size: .8rem; font-weight: 600; cursor: pointer; transition: var(--transition); color: var(--text-muted); }
.filter-tab.is-active { background: var(--accent); color: var(--primary); border-color: var(--accent); }

/* ---- LOOKUP STATUS ---- */
[data-customer-lookup-status] { font-size: .82rem; padding: 6px 10px; border-radius: var(--radius-sm); margin-top: 6px; }
[data-customer-lookup-status][data-status="loading"] { background: #E3F2FD; color: #0D47A1; }
[data-customer-lookup-status][data-status="found"]   { background: #E8F5E9; color: #1B5E20; }

/* ---- FOOTER ---- */
.site-footer { background: var(--primary); color: rgba(255,255,255,.6); text-align: center; padding: 28px 20px; font-size: .82rem; margin-top: auto; }
.site-footer strong { color: var(--accent); }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .92rem; }

/* ---- LOADING ---- */
.loading-spinner { text-align: center; padding: 32px; color: var(--text-muted); }
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- TICKET CARD ---- */
.ticket-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; }
.ticket-raffle { font-weight: 700; font-size: .9rem; color: var(--primary); margin-bottom: 4px; }
.ticket-nums   { font-size: .82rem; color: var(--text-muted); margin-bottom: 6px; word-break: break-all; }
.ticket-meta   { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.ticket-amount { font-weight: 700; color: var(--accent); font-size: .92rem; }

/* ---- SUCCESS SCREEN ---- */
.success-card { text-align: center; padding: 32px 24px; }
.success-icon { font-size: 4rem; margin-bottom: 16px; }
.success-title { font-size: 1.6rem; color: var(--success); margin-bottom: 8px; }
.success-numbers { background: var(--cream-dark); border-radius: var(--radius-sm); padding: 12px; margin: 16px 0; font-family: monospace; font-size: .9rem; color: var(--primary); word-break: break-all; }

/* ---- QUICK RANDOM ---- */
.quick-random-box { background: var(--cream-dark); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.qty-controls { display: flex; align-items: center; gap: 10px; }
.qty-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; border: none; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.qty-btn:hover { background: var(--accent); color: var(--primary); }
.qty-display { font-size: 1.6rem; font-weight: 700; color: var(--primary); font-family: 'Playfair Display', serif; min-width: 48px; text-align: center; }

/* ---- SCROLLBAR ---- */
.numbers-grid::-webkit-scrollbar { width: 6px; }
.numbers-grid::-webkit-scrollbar-track { background: var(--cream-dark); border-radius: 3px; }
.numbers-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .header-inner { height: 56px; }
  .logo-text { font-size: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 20px 16px; }
}
