/*
 * RankUp India — Production stylesheet
 * ============================================================
 * HOW THIS FILE WAS MADE — READ THIS FIRST
 *
 * During development the pages use Tailwind CSS from the CDN
 * (see the comment in includes/header.php). That CDN link is a
 * development aid only and must NOT be relied on in production.
 *
 * This file is the production stylesheet. It is a real, usable,
 * hand-written CSS file that covers the utility classes actually
 * used by the pages in this project (layout, cards, buttons,
 * forms, tables, badges, navigation, hero, leaderboard, alerts,
 * pagination, toasts, modals), plus base typography, visible
 * focus states and mobile-first responsive breakpoints.
 *
 * Tailwind CLI was NOT run in this environment, and this file
 * does NOT claim to be Tailwind CLI output. It is a compatible
 * utility stylesheet written to match the class names the PHP
 * templates use, so the site works with no CDN at all.
 *
 * HOW TO REBUILD WITH TAILWIND CLI (optional, on your own PC):
 *   1. npm install -D tailwindcss
 *   2. npx tailwindcss init
 *   3. Set content to ["./**\/*.php", "./assets/js/*.js"]
 *   4. npx tailwindcss -i ./assets/css/input.css -o ./assets/css/style.css --minify
 *   5. Keep a backup of this file first. After rebuilding, check
 *      the homepage, leaderboard and admin pages on mobile width.
 * Until you do that, ship this file as-is and remove the CDN link
 * from the header include.
 *
 * Colours: light theme, white surfaces, dark slate text,
 * indigo (#4f46e5) / violet accents. See ARCHITECTURE.md.
 */

/* ---------- Variables and reset ---------- */
:root {
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --indigo-light: #eef2ff;
  --violet: #7c3aed;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --green: #15803d;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --radius: 0.75rem;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.10);
  --max-width: 72rem;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--slate-900);
  background: var(--slate-50);
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; font-weight: 700; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; } h4 { font-size: 1.125rem; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* Visible focus state for keyboard users (accessibility). */
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; border-radius: 0.25rem; }
.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; }
.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--indigo); color: #fff; padding: 0.5rem 1rem; border-radius: 0.5rem; z-index: 100; }
.skip-link:focus { top: 1rem; color: #fff; text-decoration: none; }

/* ---------- Layout utilities ---------- */
.container { width: 100%; max-width: var(--max-width); margin-left: auto; margin-right: auto; padding-left: 1rem; padding-right: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-7xl { max-width: 80rem; } .max-w-4xl { max-width: 56rem; } .max-w-2xl { max-width: 42rem; } .max-w-xl { max-width: 36rem; }
.w-full { width: 100%; } .w-auto { width: auto; }
.min-h-screen { min-height: 100vh; }
.block { display: block; } .inline-block { display: inline-block; } .hidden { display: none !important; }
.flex { display: flex; } .inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; } .flex-row { flex-direction: row; } .flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.flex-1 { flex: 1 1 0%; } .flex-shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; } .gap-8 { gap: 2rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Spacing (the sizes used by the templates). */
.p-0 { padding: 0; } .p-2 { padding: 0.5rem; } .p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; } .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; } .px-4 { padding-left: 1rem; padding-right: 1rem; } .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; } .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; } .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; } .py-4 { padding-top: 1rem; padding-bottom: 1rem; } .py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; } .py-8 { padding-top: 2rem; padding-bottom: 2rem; } .py-12 { padding-top: 3rem; padding-bottom: 3rem; } .py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.pt-4 { padding-top: 1rem; } .pt-6 { padding-top: 1.5rem; } .pb-4 { padding-bottom: 1rem; } .pb-6 { padding-bottom: 1.5rem; }
.m-0 { margin: 0; } .mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.ml-2 { margin-left: 0.5rem; } .mr-2 { margin-right: 0.5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; } .space-y-4 > * + * { margin-top: 1rem; } .space-y-6 > * + * { margin-top: 1.5rem; }

/* Text and colour utilities. */
.text-center { text-align: center; } .text-left { text-align: left; } .text-right { text-align: right; }
.text-xs { font-size: 0.75rem; line-height: 1.4; } .text-sm { font-size: 0.875rem; line-height: 1.5; }
.text-base { font-size: 1rem; } .text-lg { font-size: 1.125rem; } .text-xl { font-size: 1.25rem; } .text-2xl { font-size: 1.5rem; } .text-3xl { font-size: 1.875rem; } .text-4xl { font-size: 2.25rem; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.text-slate-900, .text-gray-900 { color: var(--slate-900); } .text-slate-700, .text-gray-700 { color: var(--slate-700); }
.text-slate-500, .text-gray-500 { color: var(--slate-500); } .text-white { color: #fff; }
.text-indigo-600 { color: var(--indigo); } .text-green-700 { color: var(--green); } .text-red-600 { color: var(--red); } .text-amber-700 { color: var(--amber); }
.bg-white { background: var(--white); } .bg-slate-50, .bg-gray-50 { background: var(--slate-50); } .bg-slate-100, .bg-gray-100 { background: var(--slate-100); }
.bg-indigo-600 { background: var(--indigo); } .bg-indigo-50 { background: var(--indigo-light); }
.bg-green-100 { background: var(--green-bg); } .bg-amber-100 { background: var(--amber-bg); } .bg-red-100 { background: var(--red-bg); }
.border { border: 1px solid var(--slate-200); } .border-t { border-top: 1px solid var(--slate-200); } .border-b { border-bottom: 1px solid var(--slate-200); }
.border-slate-200 { border-color: var(--slate-200); } .border-indigo-600 { border-color: var(--indigo); }
.rounded { border-radius: 0.375rem; } .rounded-lg { border-radius: 0.5rem; } .rounded-xl { border-radius: var(--radius); } .rounded-full { border-radius: 9999px; }
.shadow { box-shadow: var(--shadow); } .shadow-lg { box-shadow: var(--shadow-lg); } .shadow-sm { box-shadow: 0 1px 2px rgba(15,23,42,0.06); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overflow-x-auto { overflow-x: auto; } .overflow-hidden { overflow: hidden; }
.relative { position: relative; } .absolute { position: absolute; } .sticky { position: sticky; } .top-0 { top: 0; } .z-10 { z-index: 10; } .z-50 { z-index: 50; }

/* ---------- Header / navigation ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--slate-200); position: sticky; top: 0; z-index: 40; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.site-logo { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.25rem; color: var(--slate-900); }
.site-logo:hover { text-decoration: none; }
.site-logo img { width: 2rem; height: 2rem; border-radius: 0.5rem; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 0.5rem; background: var(--indigo); color: #fff; font-weight: 700; }
.main-nav { display: none; align-items: center; gap: 0.25rem; }
.main-nav a { color: var(--slate-700); padding: 0.5rem 0.75rem; border-radius: 0.5rem; font-weight: 500; }
.main-nav a:hover, .main-nav a.active { background: var(--indigo-light); color: var(--indigo); text-decoration: none; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; background: #fff; border: 1px solid var(--slate-200); border-radius: 0.5rem; font-size: 1.25rem; }
.mobile-nav { display: none; background: #fff; border-bottom: 1px solid var(--slate-200); padding: 0.75rem 1rem 1rem; }
.mobile-nav.open { display: block; }
.mobile-nav a { display: block; padding: 0.75rem 0.5rem; border-radius: 0.5rem; color: var(--slate-700); font-weight: 500; }
.mobile-nav a:hover { background: var(--slate-100); text-decoration: none; }

/* ---------- Hero, cards, leaderboard ---------- */
.hero { background: #fff; border-bottom: 1px solid var(--slate-200); padding: 3rem 0; text-align: center; }
.hero h1 { font-size: 2.25rem; margin-bottom: 0.75rem; }
.hero p.lead { font-size: 1.125rem; color: var(--slate-500); max-width: 42rem; margin: 0 auto 1.5rem; }
.card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card:hover { box-shadow: var(--shadow-lg); }
.card-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.25rem; }
.card-title a { color: var(--slate-900); }
.listing-card { display: flex; gap: 1rem; align-items: flex-start; }
.listing-logo { width: 3rem; height: 3rem; flex-shrink: 0; border-radius: 0.75rem; background: var(--indigo-light); color: var(--indigo); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.25rem; overflow: hidden; }
.listing-logo img { width: 100%; height: 100%; object-fit: cover; }
.rank-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 0.5rem; border-radius: 9999px; background: var(--slate-100); color: var(--slate-700); font-weight: 700; font-size: 0.875rem; }
.rank-1 { background: #fef3c7; color: #92400e; } .rank-2 { background: #e2e8f0; color: #334155; } .rank-3 { background: #ffedd5; color: #9a3412; }
.leader-row { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 1rem; display: flex; gap: 1rem; align-items: center; }
.leader-row.top-3 { border-color: #c7d2fe; background: #eef2ff; }
.bid-amount { font-weight: 700; color: var(--indigo); white-space: nowrap; }
.featured-leader { border: 2px solid var(--indigo); background: #fff; }
.steps { counter-reset: step; }
.step-card { position: relative; padding-top: 1rem; }
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; line-height: 1.5; }
.badge-green { background: var(--green-bg); color: var(--green); } .badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); } .badge-indigo { background: var(--indigo-light); color: var(--indigo); }
.badge-slate { background: var(--slate-100); color: var(--slate-700); }
.demo-badge { background: var(--amber-bg); color: var(--amber); }

/* Tabs (All-Time / Today / This Month). */
.tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; border-bottom: 1px solid var(--slate-200); padding-bottom: 0.5rem; }
.tab { border: 1px solid var(--slate-200); background: #fff; color: var(--slate-700); padding: 0.5rem 1rem; border-radius: 9999px; font-weight: 600; }
.tab:hover { border-color: var(--indigo); color: var(--indigo); }
.tab[aria-selected="true"], .tab.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.625rem 1.25rem; border-radius: 0.5rem; border: 1px solid transparent; font-weight: 600; font-size: 0.95rem; line-height: 1.25; text-align: center; }
.btn:hover { text-decoration: none; }
.btn-primary, .btn-indigo { background: var(--indigo); color: #fff; }
.btn-primary:hover, .btn-indigo:hover { background: var(--indigo-dark); }
.btn-secondary { background: #fff; border-color: var(--slate-300); color: var(--slate-900); }
.btn-secondary:hover { background: var(--slate-100); }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover { background: #991b1b; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { min-height: 2.25rem; padding: 0.375rem 0.75rem; font-size: 0.875rem; }
.btn-lg { min-height: 3.25rem; padding: 0.875rem 1.5rem; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.btn.is-loading { opacity: 0.7; pointer-events: none; }

/* ---------- Forms ---------- */
.form-label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.375rem; }
.form-input, .form-select, .form-textarea {
  display: block; width: 100%; padding: 0.625rem 0.75rem; border: 1px solid var(--slate-300);
  border-radius: 0.5rem; background: #fff; min-height: 2.75rem;
}
.form-textarea { min-height: 7rem; resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--indigo); outline: 3px solid rgba(79,70,229,0.25); outline-offset: 0; }
.form-input[aria-invalid="true"], .form-input.is-invalid { border-color: var(--red); }
.form-help { font-size: 0.8125rem; color: var(--slate-500); margin-top: 0.25rem; }
.form-error { font-size: 0.875rem; color: var(--red); margin-top: 0.25rem; font-weight: 500; }
.form-group { margin-bottom: 1rem; }
input[type="checkbox"], input[type="radio"] { width: 1.125rem; height: 1.125rem; accent-color: var(--indigo); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--slate-200); vertical-align: top; }
.table th { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--slate-500); background: var(--slate-50); }
.table tbody tr:hover { background: var(--slate-50); }
.table-wrap { overflow-x: auto; border: 1px solid var(--slate-200); border-radius: var(--radius); background: #fff; }

/* ---------- Alerts, toasts, pagination, footer, misc ---------- */
.alert { padding: 0.875rem 1rem; border-radius: 0.5rem; border: 1px solid; margin-bottom: 1rem; }
.alert-success { background: var(--green-bg); border-color: #86efac; color: #14532d; }
.alert-error, .alert-danger { background: var(--red-bg); border-color: #fca5a5; color: #7f1d1d; }
.alert-info { background: var(--indigo-light); border-color: #c7d2fe; color: #312e81; }
.alert-warning { background: var(--amber-bg); border-color: #fcd34d; color: #78350f; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--slate-500); background: #fff; border: 1px dashed var(--slate-300); border-radius: var(--radius); }
.pagination { display: flex; gap: 0.375rem; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 2.5rem; min-height: 2.5rem; padding: 0.25rem 0.75rem; border: 1px solid var(--slate-200); border-radius: 0.5rem; background: #fff; color: var(--slate-700); font-weight: 600; }
.pagination a:hover { border-color: var(--indigo); color: var(--indigo); text-decoration: none; }
.pagination .current { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.breadcrumb { font-size: 0.875rem; color: var(--slate-500); margin-bottom: 1rem; }
.breadcrumb a { color: var(--slate-500); }
.site-footer { background: #fff; border-top: 1px solid var(--slate-200); margin-top: 3rem; padding: 2.5rem 0 1.5rem; color: var(--slate-500); font-size: 0.9rem; }
.site-footer a { color: var(--slate-700); }
.site-footer h3, .site-footer h4 { color: var(--slate-900); font-size: 1rem; }
.toast-wrap { position: fixed; bottom: 1rem; right: 1rem; left: 1rem; z-index: 90; display: flex; flex-direction: column; gap: 0.5rem; align-items: stretch; pointer-events: none; }
.toast { pointer-events: auto; background: var(--slate-900); color: #fff; padding: 0.75rem 1rem; border-radius: 0.5rem; box-shadow: var(--shadow-lg); font-size: 0.95rem; }
.toast-success { background: var(--green); } .toast-error { background: var(--red); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 80; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 1.5rem; max-width: 28rem; width: 100%; box-shadow: var(--shadow-lg); }
.admin-layout { display: flex; flex-direction: column; min-height: 100vh; }
.admin-sidebar { background: var(--slate-900); color: #e2e8f0; padding: 1rem; }
.admin-sidebar a { display: block; color: #e2e8f0; padding: 0.625rem 0.75rem; border-radius: 0.5rem; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: #1e293b; color: #fff; text-decoration: none; }
.stat-card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 1.25rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.875rem; color: var(--slate-500); }
.prose { max-width: 42rem; } .prose h2 { margin-top: 1.5rem; } .prose a { text-decoration: underline; }
.install-steps { display: flex; gap: 0.5rem; flex-wrap: wrap; list-style: none; padding: 0; }
.install-steps li { padding: 0.5rem 0.75rem; border-radius: 9999px; background: var(--slate-100); font-size: 0.875rem; font-weight: 600; }
.install-steps li.active { background: var(--indigo); color: #fff; }
.install-steps li.done { background: var(--green-bg); color: var(--green); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--slate-900); color: #e2e8f0; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-size: 0.875rem; }
code { background: var(--slate-100); padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-size: 0.875em; }
pre code { background: transparent; padding: 0; }

/* ---------- Responsive breakpoints (mobile-first) ---------- */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:flex-row { flex-direction: row; }
  .toast-wrap { left: auto; width: 22rem; }
  h1 { font-size: 2.5rem; } .hero h1 { font-size: 2.75rem; }
}
@media (min-width: 768px) {
  .main-nav { display: flex; }
  .nav-toggle { display: none; }
  .mobile-nav, .mobile-nav.open { display: none; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:flex-row { flex-direction: row; }
  .admin-layout { flex-direction: row; }
  .admin-sidebar { width: 16rem; flex-shrink: 0; min-height: 100vh; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .admin-main { flex: 1; min-width: 0; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .container { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
@media print {
  .site-header, .site-footer, .nav-toggle, .toast-wrap { display: none; }
  body { background: #fff; }
}
