/* ============================================
   Gran Rifa - Design System 2026
   Clean, minimal, modern
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Primary - Deep, confident green */
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-darker: #166534;
  --primary-light: rgba(22, 163, 74, 0.08);
  --primary-lighter: rgba(22, 163, 74, 0.04);

  /* Accent - Warm for CTAs */
  --accent: #f97316;
  --accent-dark: #ea580c;
  --accent-light: rgba(249, 115, 22, 0.08);

  /* Semantic */
  --success: #22c55e;
  --success-light: #dcfce7;
  --warning: #eab308;
  --warning-light: #fef9c3;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  /* Neutrals - Refined */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #cbd5e1;

  --bg-page: #fafafa;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radius - Rounder, softer */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows - Ultra subtle */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-ring: 0 0 0 1px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

main.container {
  flex: 1;
  padding-top: var(--space-8);
  padding-bottom: var(--space-12);
}

@media (min-width: 640px) {
  .container {
    max-width: 480px;
    padding: 0 var(--space-6);
  }
}

/* ============================================
   Header - Minimal
   ============================================ */

.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.logo {
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: opacity var(--transition-fast);
}

.logo svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-primary);
}

.logo:hover {
  opacity: 0.6;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.admin-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.admin-nav a:hover {
  color: var(--text-primary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0;
  transition: color var(--transition-fast);
}

.btn-link:hover {
  color: var(--text-primary);
}

/* ============================================
   Footer - Quiet
   ============================================ */

.site-footer {
  border-top: 1px solid var(--border-light);
  padding: var(--space-6) 0;
  margin-top: auto;
  text-align: center;
}

.site-footer p {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ============================================
   Cards - Clean surfaces
   ============================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--text-light);
}

.card-elevated {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.card-elevated:hover {
  box-shadow: var(--shadow-lg);
}

/* ============================================
   Buttons - Refined
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

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

.btn-primary {
  background: var(--text-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #1e293b;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--primary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--text-light);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================================
   Forms - Minimal
   ============================================ */

label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-light);
}

input:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled) {
  border-color: var(--text-light);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg-subtle);
  cursor: not-allowed;
  opacity: 0.6;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

input[type="file"] {
  padding: var(--space-3);
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  padding: var(--space-2) var(--space-4);
  margin-right: var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

input[type="file"]::file-selector-button:hover {
  background: var(--border);
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* ============================================
   Progress Bar
   ============================================ */

.progress-bar {
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
}

.progress-bar__fill {
  background: var(--primary);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-bar__text {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: var(--space-2);
  text-align: center;
}

/* ============================================
   Flash Messages
   ============================================ */

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: var(--success-light);
  color: #166534;
}

.flash-error {
  background: var(--danger-light);
  color: #991b1b;
}

.flash-warning {
  background: var(--warning-light);
  color: #854d0e;
}

/* ============================================
   Badges
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-warning { background: var(--warning-light); color: #854d0e; }
.badge-success { background: var(--success-light); color: #166534; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-pending { background: var(--primary-light); color: var(--primary-dark); }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: var(--gray-100); color: var(--gray-500); }

/* ============================================
   Tables
   ============================================ */

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:hover td {
  background: var(--bg-subtle);
}

/* ============================================
   Utilities
   ============================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mt-3 { margin-top: var(--space-6); }
.mt-4 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.mb-3 { margin-bottom: var(--space-6); }
.mb-4 { margin-bottom: var(--space-8); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease-out; }

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

@media (min-width: 768px) {
  main.container {
    padding-top: var(--space-10);
    padding-bottom: var(--space-16);
  }
}
