/* ============================================
   Lucky Draw & Loan System - Stylesheet
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #7c3aed;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ---- HEADER ---- */
.site-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  color: white;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.logo {
  font-size: 1.4rem; font-weight: 700; color: white;
  text-decoration: none; letter-spacing: -0.5px;
}
nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
nav a {
  color: rgba(255,255,255,0.88); text-decoration: none;
  padding: 6px 12px; border-radius: 6px; font-size: 0.9rem;
  transition: background 0.2s;
}
nav a:hover { background: rgba(255,255,255,0.15); color: white; }
.btn-admin {
  background: rgba(255,255,255,0.2) !important;
  border: 1px solid rgba(255,255,255,0.4);
  color: white !important; font-weight: 600;
}
.btn-admin:hover { background: rgba(255,255,255,0.3) !important; }

/* ---- MAIN ---- */
main.container { padding-top: 32px; padding-bottom: 40px; flex: 1; }

/* ---- FOOTER ---- */
.site-footer {
  background: #1e293b; color: #94a3b8;
  text-align: center; padding: 20px;
  font-size: 0.88rem;
}

/* ---- CARDS ---- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
  border: 1px solid var(--border); margin-bottom: 24px;
}
.card-title {
  font-size: 1.2rem; font-weight: 700; color: var(--primary);
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-weight: 600; margin-bottom: 6px;
  font-size: 0.9rem; color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.95rem; color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-block; padding: 10px 24px;
  border-radius: 8px; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; border: none; text-decoration: none;
  transition: all 0.2s; text-align: center;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-secondary { background: #64748b; color: white; }
.btn-sm { padding: 5px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; display: block; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 18px; border-radius: 8px;
  margin-bottom: 20px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-danger,
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead tr { background: var(--primary); color: white; }
thead th { padding: 12px 14px; text-align: left; font-weight: 600; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 11px 14px; vertical-align: middle; }

/* ---- BADGES ---- */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #e2e8f0; color: #475569; }

/* ---- HOMEPAGE HERO ---- */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  border-radius: 14px; color: white;
  padding: 54px 40px; text-align: center; margin-bottom: 40px;
}
.hero h1 { font-size: 2.4rem; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; opacity: 0.88; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions a {
  padding: 13px 28px; border-radius: 8px; font-weight: 700;
  text-decoration: none; font-size: 1rem; transition: all 0.2s;
}
.hero-actions .btn-white { background: white; color: #1e3a8a; }
.hero-actions .btn-white:hover { background: #f0f4ff; }
.hero-actions .btn-outline {
  border: 2px solid rgba(255,255,255,0.7); color: white;
}
.hero-actions .btn-outline:hover { background: rgba(255,255,255,0.15); }

/* ---- STAT CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: white; border-radius: var(--radius);
  padding: 24px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-card .stat-icon { font-size: 2.2rem; margin-bottom: 10px; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

/* ---- PAGE TITLE ---- */
.page-title {
  font-size: 1.7rem; font-weight: 800; color: var(--text);
  margin-bottom: 24px;
}
.page-title span { color: var(--primary); }

/* ---- TICKET CARD ---- */
.ticket-card {
  background: linear-gradient(135deg, #1e3a8a, #7c3aed);
  color: white; border-radius: 14px; padding: 28px;
  text-align: center; margin: 20px auto; max-width: 400px;
  box-shadow: 0 8px 30px rgba(37,99,235,0.3);
}
.ticket-card .ticket-no { font-size: 1.4rem; font-weight: 800; letter-spacing: 2px; }
.ticket-card .ticket-meta { opacity: 0.8; font-size: 0.9rem; margin-top: 8px; }
.ticket-card .ticket-qr { margin: 18px auto; }
.ticket-card .ticket-qr img { width: 140px; height: 140px; border-radius: 8px; border: 3px solid white; }

/* ---- WINNERS DISPLAY ---- */
.winner-card {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 14px; padding: 24px; text-align: center;
  margin-bottom: 16px; color: white;
  box-shadow: 0 4px 16px rgba(245,158,11,0.3);
}
.winner-card .crown { font-size: 2.5rem; }
.winner-card .winner-name { font-size: 1.3rem; font-weight: 800; margin-top: 8px; }
.winner-card .winner-prize { font-size: 1.6rem; font-weight: 900; margin-top: 4px; }
.winner-card .winner-meta { font-size: 0.85rem; opacity: 0.85; margin-top: 6px; }

/* ---- ADMIN ---- */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 0px); }
.admin-sidebar {
  background: #1e293b; color: #cbd5e1; padding: 24px 0;
  min-height: 100vh;
}
.admin-sidebar .sidebar-logo {
  padding: 0 20px 20px; font-size: 1.1rem; font-weight: 800;
  color: white; border-bottom: 1px solid #334155;
}
.admin-sidebar nav { padding-top: 12px; }
.admin-sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: #94a3b8; text-decoration: none;
  font-size: 0.92rem; transition: all 0.2s;
}
.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
  background: rgba(255,255,255,0.08); color: white;
  border-left: 3px solid var(--primary);
}
.admin-main { padding: 32px; background: var(--bg); }
.admin-topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 28px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.7rem; }
  .hero { padding: 36px 20px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { min-height: auto; }
  nav { gap: 3px; }
  nav a { padding: 5px 8px; font-size: 0.82rem; }
}
