/* ============================================
   FoxPay Download Center — Design System
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; line-height: 1.6; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  color: #1e293b;
  background: #f1f5f9;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
table { border-collapse: collapse; width: 100%; }

/* --- Tokens --- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #6366f1;
  --accent-light: #e0e7ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
  --gradient: linear-gradient(135deg, #1e40af 0%, #4f46e5 50%, #7c3aed 100%);
  --gradient-btn: linear-gradient(135deg, #2563eb, #6366f1);
}

/* --- Layout --- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 1rem; }

/* --- PUBLIC PAGES — Header --- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,.92);
}
.site-header .container {
  display: flex; justify-content: space-between; align-items: center;
  height: 60px;
}
.site-logo { display: flex; align-items: center; gap: .5rem; }
.site-logo img { height: 32px; width: auto; }
.site-logo span { font-weight: 700; font-size: 1.2rem; color: var(--primary); }
.site-header-right { display: flex; align-items: center; gap: 1rem; font-size: .875rem; color: var(--text-secondary); }
.site-header-right a { color: var(--primary); transition: opacity .2s; }
.site-header-right a:hover { opacity: .75; }

/* --- Hero Banner --- */
.hero {
  background: var(--gradient);
  padding: 3.5rem 1rem 3rem;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 20% 80%, rgba(255,255,255,.08) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255,255,255,.06) 0%, transparent 50%);
}
.hero-inner { position: relative; z-index: 1; }
.hero-logo { height: 64px; margin: 0 auto 1rem; }
.hero h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.hero p { font-size: 1rem; opacity: .85; }

/* --- Download Cards --- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow .3s, transform .3s;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 1.5rem 1.5rem 1rem;
}
.card-header-info h3 { font-size: 1.15rem; font-weight: 600; color: var(--text); margin-bottom: .25rem; }
.card-header-info p { font-size: .85rem; color: var(--text-secondary); }
.card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary); flex-shrink: 0;
}
.card-icon svg { width: 24px; height: 24px; }
.card-body { padding: 0 1.5rem 1.5rem; }

/* --- Latest Version Block --- */
.latest-version {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  margin-bottom: 1rem;
}
.version-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--gradient-btn); color: #fff;
  font-size: .75rem; font-weight: 600;
  padding: .25rem .65rem; border-radius: 20px;
}
.version-meta { font-size: .8rem; color: var(--text-muted); }
.download-count { font-size: .75rem; color: var(--text-muted); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.25rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  border: none; cursor: pointer;
  transition: all .2s;
}
.btn-primary {
  background: var(--gradient-btn); color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(37,99,235,.35); transform: translateY(-1px); }
.btn-sm {
  padding: .35rem .75rem; font-size: .8rem; border-radius: 6px;
  background: var(--gradient-btn); color: #fff;
  box-shadow: 0 1px 4px rgba(37,99,235,.2);
}
.btn-sm:hover { box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-ghost {
  background: transparent; color: var(--primary);
  padding: .35rem .5rem; font-size: .85rem;
}
.btn-ghost:hover { background: var(--primary-light); border-radius: 6px; }

/* --- Update Notes --- */
.notes-box {
  margin-top: .75rem; padding: .75rem 1rem;
  background: #f8fafc; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.notes-box h4 { font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem; }
.notes-box p { font-size: .825rem; color: var(--text); line-height: 1.6; }
.notes-box .empty { color: var(--text-muted); font-style: italic; }

/* --- History Toggle --- */
.history-toggle {
  display: flex; align-items: center; gap: .4rem;
  color: var(--primary); font-size: .875rem; font-weight: 500;
  cursor: pointer; padding: .5rem 0; border: none; background: none;
  transition: color .2s;
}
.history-toggle:hover { color: var(--accent); }
.history-toggle svg { width: 16px; height: 16px; transition: transform .3s; }
.history-toggle.open svg { transform: rotate(180deg); }

/* --- Version Timeline --- */
.version-list { display: flex; flex-direction: column; gap: 0; overflow: hidden; transition: max-height .4s ease, opacity .3s ease; }
.version-list.collapsed { max-height: 0; opacity: 0; }
.version-list.expanded { max-height: 5000px; opacity: 1; }

.version-item {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
}
.version-item:last-child { border-bottom: none; }
.version-item-badge {
  flex-shrink: 0; min-width: 56px;
  background: var(--accent-light); color: var(--accent);
  font-size: .75rem; font-weight: 600;
  padding: .2rem .5rem; border-radius: 6px; text-align: center;
}
.version-item-info { flex: 1; min-width: 0; }
.version-item-info .file-name { font-size: .825rem; color: var(--text); font-weight: 500; }
.version-item-meta {
  display: flex; flex-wrap: wrap; gap: .75rem;
  font-size: .75rem; color: var(--text-muted); margin-top: .2rem;
}
.version-item-actions { flex-shrink: 0; }
.version-item-notes {
  margin-top: .4rem; padding: .5rem .75rem;
  background: #f8fafc; border-radius: 6px;
  font-size: .8rem; color: var(--text-secondary); line-height: 1.5;
}

/* --- Info Section --- */
.info-section {
  background: var(--surface); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-top: 2rem;
  border: 1px solid var(--border);
}
.info-section h4 { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; margin-bottom: .5rem; }
.info-section h4 svg { color: var(--primary); }
.info-section ul { list-style: disc; padding-left: 1.25rem; font-size: .85rem; color: var(--text-secondary); }
.info-section li { margin-bottom: .25rem; }

/* --- Footer --- */
.site-footer {
  margin-top: 3rem; padding: 2rem 1rem;
  background: var(--surface); border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.footer-brand { display: flex; align-items: center; gap: .5rem; }
.footer-brand img { height: 24px; opacity: .6; }
.footer-brand span { font-size: .85rem; color: var(--text-muted); }
.footer-copy { font-size: .8rem; color: var(--text-muted); }

/* --- Alerts --- */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; margin-bottom: 1rem;
}
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #86efac; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #93c5fd; }

/* --- LOGIN PAGE --- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--gradient); padding: 1rem;
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(255,255,255,.06) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(255,255,255,.04) 0%, transparent 50%);
}
.login-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2.5rem 2rem;
  width: 100%; max-width: 400px; position: relative; z-index: 1;
}
.login-card .logo-area { text-align: center; margin-bottom: 1.5rem; }
.login-card .logo-area img { height: 40px; margin: 0 auto .75rem; }
.login-card .logo-area h1 { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.login-card .logo-area h2 { font-size: 1rem; color: var(--text-secondary); margin-top: .25rem; }

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; color: var(--text); margin-bottom: .35rem; }
.form-input {
  width: 100%; padding: .6rem .75rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  background: var(--surface);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-input-icon {
  position: relative;
}
.form-input-icon svg {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted);
}
.form-input-icon .form-input { padding-left: 2.5rem; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.required { color: var(--danger); }

.btn-full {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 500;
  background: var(--gradient-btn); color: #fff; border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
  transition: all .2s;
}
.btn-full:hover { box-shadow: 0 4px 16px rgba(37,99,235,.35); transform: translateY(-1px); }

/* ============================================
   ADMIN PAGES — Tailwind utility replacements
   ============================================ */

/* Layout */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-x-2 > * + * { margin-left: .5rem; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.min-h-screen { min-height: 100vh; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-y-0 { top: 0; bottom: 0; }
.left-0 { left: 0; }
.min-w-full { min-width: 100%; }

/* Spacing */
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.pl-3 { padding-left: .75rem; }
.pl-5 { padding-left: 1.25rem; }
.pl-10 { padding-left: 2.5rem; }
.mr-1 { margin-right: .25rem; }
.mr-2 { margin-right: .5rem; }
.mr-3 { margin-right: .75rem; }
.mr-4 { margin-right: 1rem; }

.ml-3 { margin-left: .75rem; }
.mt-1 { margin-top: .25rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }

/* Sizing */
.w-full { width: 100%; }
.h-8 { height: 2rem; }
.h-16 { height: 4rem; }

/* Typography */
.text-xs { font-size: .75rem; line-height: 1rem; }
.text-sm { font-size: .875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: .05em; }
.whitespace-nowrap { white-space: nowrap; }
.list-disc { list-style-type: disc; }
.text-center { text-align: center; }
.text-left { text-align: left; }

/* Colors */
.text-white { color: #fff; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-blue-600 { color: #2563eb; }
.text-blue-800 { color: #1e40af; }
.text-green-600 { color: #16a34a; }
.text-green-800 { color: #166534; }
.text-purple-600 { color: #9333ea; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }
.text-red-800 { color: #991b1b; }

.bg-white { background-color: #fff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-600 { background-color: #2563eb; }
.bg-green-100 { background-color: #dcfce7; }
.bg-green-600 { background-color: #16a34a; }
.bg-purple-100 { background-color: #f3e8ff; }
.bg-red-100 { background-color: #fee2e2; }

/* Borders */
.border { border: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-red-400 { border-color: #f87171; }
.border-green-400 { border-color: #4ade80; }
.rounded { border-radius: .25rem; }
.rounded-md { border-radius: .375rem; }
.rounded-lg { border-radius: .5rem; }
.rounded-full { border-radius: 9999px; }
.divide-y > * + * { border-top: 1px solid #e5e7eb; }

/* Effects */
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.transition { transition: all .2s; }

/* Display */
.block { display: block; }
.inline-flex { display: inline-flex; align-items: center; }
.hidden { display: none; }
@media (max-width: 639px) { .hide-mobile { display: none; } }

/* Hover */
.hover\:bg-gray-300:hover { background-color: #d1d5db; }
.hover\:bg-blue-700:hover { background-color: #1d4ed8; }
.hover\:bg-green-700:hover { background-color: #15803d; }
.hover\:text-red-600:hover { color: #dc2626; }
.hover\:text-blue-800:hover { color: #1e40af; }
.hover\:text-red-800:hover { color: #991b1b; }
.hover\:underline:hover { text-decoration: underline; }
.cursor-pointer { cursor: pointer; }

/* Responsive */
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:mt-0 { margin-top: 0; }
  .sm\:pt-0 { padding-top: 0; }
}
@media (min-width: 768px) {
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Admin-specific extras */
.px-2\.5 { padding-left: .625rem; padding-right: .625rem; }
.py-0\.5 { padding-top: .125rem; padding-bottom: .125rem; }
.error-message { white-space: pre-line; }

/* Spinner animation */
@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

/* Icon inline sizing */
.icon-inline { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; }
