/* File: css/style.css */

/* ===============================
   THEME VARIABLES
   =============================== */
:root {
  --clr-dark-bg: #1a1a2e;        /* Deep dark blue/charcoal */
  --clr-card-bg: #2b2c49;        /* Slightly lighter dark for cards */
  --clr-accent-1: #00f0ff;       /* Electric blue */
  --clr-accent-2: #ff007f;       /* Vibrant magenta */
  --clr-text-light: #e0e0e0;
  --clr-text-muted: #a0a0b0;
  --clr-border: #444466;
  --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.2);
  --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.3);

  --font-primary: 'Poppins', sans-serif;
  --font-secondary: 'Inter', sans-serif;
}

/* ===============================
   RESET / BASE
   =============================== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  color: var(--clr-text-light);
  overflow-x: hidden;
  background-image: url('../background.png'); /* optional background image */
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: var(--clr-dark-bg);
}

a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===============================
   LOADING SCREEN
   =============================== */
#loading-screen {
  position: fixed; inset: 0;
  background-color: var(--clr-dark-bg);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999;
  opacity: 1; visibility: visible;
  transition: opacity 0.8s ease-out, visibility 0.8s ease-out;

  /* Ensure the overlay never blocks clicks */
  pointer-events: none;
}
#loading-screen.fade-out { opacity: 0; visibility: hidden; }

.loading-content { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }

.loading-logo {
  width: 120px; height: 120px; border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
  animation: logo-pulse 2s infinite alternate ease-in-out;
}
@keyframes logo-pulse {
  0% { transform: scale(1); box-shadow: 0 0 20px rgba(0,240,255,0.5); }
  100% { transform: scale(1.05); box-shadow:
    0 0 30px rgba(0,240,255,0.8), 0 0 50px rgba(0,240,255,0.3); }
}
.loading-spinner {
  width: 50px; height: 50px;
  border: 5px solid rgba(255,255,255,0.3);
  border-top-color: var(--clr-accent-1);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===============================
   TOP BAR (GLOBAL NAV)
   =============================== */
.topbar {
  background: rgba(26, 26, 46, 0.85);
  border-bottom: 1px solid var(--clr-border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(6px);
}
.topbar .topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
}
.topbar .brand {
  font-family: var(--font-secondary);
  font-weight: 700;
  color: var(--clr-accent-1);
  letter-spacing: 0.25px;
}
.nav a { margin-left: 1rem; color: var(--clr-text-light); opacity: 0.9; }
.nav a:hover { opacity: 1; }
.btn.small { padding: 0.5rem 0.9rem; font-size: 0.95rem; }

/* ===============================
   HERO (HOME PAGE ONLY)
   =============================== */
.hero {
  background: linear-gradient(135deg, rgba(26,26,46,0.8) 0%, rgba(16,15,34,0.8) 100%);
  padding: 6rem 0 4rem;
  text-align: center; position: relative; overflow: hidden;
  border-bottom: 2px solid var(--clr-border);
}
.hero::before {
  content: ''; position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(0,240,255,0.1) 0%, transparent 70%);
  animation: bg-pulse 15s infinite alternate ease-in-out;
  z-index: 0; opacity: 0.3;
}
@keyframes bg-pulse {
  0% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.4; }
  100% { transform: scale(1); opacity: 0.3; }
}
.hero .hero-overlay { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  margin-bottom: 0.5rem;
  color: var(--clr-accent-1);
  text-shadow: 0 0 15px rgba(0,240,255,0.5);
  animation: text-glow 2s ease-in-out infinite alternate;
  max-width: 700px; margin-left: auto; margin-right: auto;
}
@keyframes text-glow {
  from { text-shadow: 0 0 10px var(--clr-accent-1), 0 0 20px var(--clr-accent-1); }
  to   { text-shadow: 0 0 20px var(--clr-accent-1), 0 0 40px var(--clr-accent-1), 0 0 60px rgba(0,240,255,0.4); }
}
.hero .tagline {
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  margin-bottom: 2.5rem; color: var(--clr-text-muted);
  max-width: 600px; margin-left: auto; margin-right: auto;
}

/* ===============================
   BUTTONS
   =============================== */
.cta-buttons {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 1.25rem; margin-top: 2rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1rem 2rem; border-radius: 10px; font-weight: 700; font-size: 1.1rem;
  transition: all 0.3s ease; min-width: 200px; position: relative; overflow: hidden; z-index: 1;
}
.btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
  transform: translateX(-100%) skewX(-30deg); transition: transform 0.5s ease-out; z-index: -1;
}
.btn:hover::before { transform: translateX(100%) skewX(-30deg); }
.btn.login {
  background: var(--clr-accent-1); color: var(--clr-dark-bg);
  box-shadow: 0 0 15px rgba(0,240,255,0.6);
}
.btn.login:hover {
  background: #00e0ff; transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0,240,255,0.8);
}
.btn.signup {
  background: var(--clr-accent-2); color: var(--clr-text-light);
  box-shadow: 0 0 15px rgba(255,0,127,0.6);
}
.btn.signup:hover {
  background: #ff1a8c; transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(255,0,127,0.8);
}
.full-width { width: 100%; }

/* ===============================
   MAIN CONTENT / FEATURE CARDS
   =============================== */
.info-sections { padding: 2.5rem 0 4rem; }

.feature {
  background-color: var(--clr-card-bg);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  border-radius: 15px;
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--clr-border);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative; overflow: hidden;
}
.feature:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 15px 40px rgba(0,0,0,0.5), 0 0 30px rgba(0,240,255,0.4);
  border-color: var(--clr-accent-1);
}
.feature::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(0,240,255,0.05) 0%, transparent 30%);
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none; /* never block clicks */
}
.feature:hover::before { opacity: 1; }

.feature h2 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  margin-bottom: 0.75rem; color: var(--clr-accent-1);
  display: flex; align-items: center; gap: 0.75rem;
}
.feature h2 span { font-size: 1.8em; line-height: 1; }
.feature p { font-size: clamp(0.95rem, 2.5vw, 1rem); color: var(--clr-text-muted); }

/* ===============================
   FORMS (LOGIN / SIGNUP / ETC.)
   =============================== */
.form-card {
  background: #ffffff; color: #222;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 2rem; max-width: 420px; margin: 1.75rem auto;
  display: flex; flex-direction: column; gap: 1rem;
  position: relative; z-index: 2; /* sits above decorative overlays */
}
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-weight: 600; color: #333; }
.form-group input {
  padding: 0.8rem 1rem; border: 1px solid #d6d6d6; border-radius: 8px; font-size: 1rem;
  position: relative; z-index: 3;
}
.form-group input:focus {
  outline: none; border-color: var(--clr-accent-1);
  box-shadow: 0 0 0 3px rgba(0,240,255,0.15);
}

/* Alerts */
.alert { display: block; }
.alert-error {
  background: #ffe3e6; color: #a10022;
  border: 1px solid #ff9aa6; border-radius: 8px;
  padding: 0.85rem 1rem; margin: 0.5rem 0 1rem; text-align: center; font-weight: 600;
}
.alert-ok {
  background: #e6fff6; color: #006b4e;
  border: 1px solid #8de0c7; border-radius: 8px;
  padding: 0.85rem 1rem; margin: 0.5rem 0 1rem; text-align: center; font-weight: 600;
}

/* ===============================
   DASHBOARD TILES / LINKS
   =============================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem; margin-top: 1rem;
}
.card-link {
  display: block;
  background: var(--clr-card-bg);
  border: 1px solid var(--clr-border);
  border-radius: 12px; padding: 1.25rem; text-align: center;
  box-shadow: var(--shadow-medium);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card-link:hover {
  transform: translateY(-4px);
  border-color: var(--clr-accent-1);
  box-shadow: 0 15px 38px rgba(0,0,0,0.45);
}

/* ===============================
   FOOTER
   =============================== */
.footer {
  text-align: center; color: var(--clr-text-muted);
  font-size: 0.9rem; padding: 2.5rem 1.5rem;
  border-top: 1px solid var(--clr-border);
}

/* ===============================
   RESPONSIVE
   =============================== */
@media (min-width: 768px) {
  .hero { padding: 8rem 0 6rem; }
  .cta-buttons { flex-direction: row; gap: 1.5rem; }
  .cta-buttons .btn { min-width: 220px; }

  .info-sections .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
  }
  .feature { margin-bottom: 0; }
}

@media (min-width: 1024px) {
  .hero h1 { font-size: 4rem; }
  .hero .tagline { font-size: 1.5rem; }
  .info-sections .container {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2.5rem;
  }
}

/* ===============================
   CAPTURE PAGE (Camera Tiles)
   =============================== */

/* Container for all slots */
.capture-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-slot {
  background: var(--clr-card-bg);
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow-light);
}

.slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}
.slot-head h3 { color: var(--clr-accent-1); margin: 0; }
.slot-remove {
  border: 1px solid var(--clr-border);
  background: rgba(255,255,255,.05);
  color: var(--clr-text-light);
  border-radius: 10px;
  padding: .2rem .6rem;
  cursor: pointer;
}
.slot-remove:hover { background: rgba(255,255,255,.09); }

/* Two tiles (front/back) side by side; stack on small screens */
.tile-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 0.35rem;
}
.tile-col { display: flex; flex-direction: column; gap: 0.45rem; }
.tile-label { color: var(--clr-text-muted); font-weight: 600; }

/* The tappable camera tile (label wraps the hidden input) */
.cam-tile { 
  display: block;
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  padding: 0.9rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  box-shadow: var(--shadow-light);
}
.cam-tile:hover {
  transform: translateY(-1px);
  border-color: var(--clr-accent-1);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

/* Hide the native file input */
.cam-tile .cam-input { display: none !important; }

/* Tile content */
.tile-face {
  display: grid;
  place-items: center;
  min-height: 160px;
  position: relative;
}
.tile-icon { color: var(--clr-text-light); opacity: .85; margin-bottom: .35rem; }
.tile-text { color: var(--clr-text-muted); font-weight: 600; }

/* Thumbnail preview: contained, not huge */
.tile-preview {
  width: 100%;
  height: 140px;               /* Thumbnail height */
  object-fit: contain;         /* Keep entire image visible */
  background: #0c0f19;         /* Nice dark backing */
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  display: none;               /* shown after selection */
}

/* When we have an image, hide the icon & helper text */
.cam-tile.has-image .tile-icon,
.cam-tile.has-image .tile-text { display: none; }

/* Capture form actions & notes */
.capture-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.muted-note { color: var(--clr-text-muted); display: block; margin-top: .5rem; }

/* Don’t let decorative overlays block taps */
.hero::before,
.feature::before { pointer-events: none; }

/* Responsive: stack tiles on narrow phones */
@media (max-width: 520px) {
  .tile-row { grid-template-columns: 1fr; }
}

/* === Capture page refinements (camera tiles) === */
.capture-hero { padding-bottom: 1.25rem; }
.capture-hero-head { display: flex; gap: 0.9rem; align-items: center; margin-bottom: .6rem; }
.capture-hero-icon { font-size: 1.6rem; }
.capture-hero-tagline { margin: .35rem 0 0; color: var(--clr-text-muted); }
.capture-hero-points { margin: .8rem 0 0 1.2rem; color: var(--clr-text-muted); }
.capture-hero-points li { margin: 0.25rem 0; }

.form-card--wide { max-width: none; }

/* dynamic slots container */
.capture-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card-slot {
  background: var(--clr-card-bg);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-light);
}
.slot-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .6rem;
}
.slot-head h3 { color: var(--clr-accent-1); margin: 0; }
.slot-remove {
  border: 1px solid var(--clr-border);
  background: rgba(255,255,255,.05);
  color: var(--clr-text-light);
  border-radius: 10px;
  padding: .2rem .6rem;
  cursor: pointer;
}
.slot-remove:hover { background: rgba(255,255,255,.09); }

/* two tiles (front/back) per row on mobile+, stack on tiny phones */
.tile-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
}
.tile-col { display: flex; flex-direction: column; gap: .45rem; }
.tile-label { color: var(--clr-text-muted); font-weight: 600; }

/* hide native input and make the label tappable tile */
.cam-tile .cam-input { display: none !important; }
.cam-tile {
  display: block;
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  padding: 0.9rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  box-shadow: var(--shadow-light);
}
.cam-tile:hover {
  transform: translateY(-1px);
  border-color: var(--clr-accent-1);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.tile-face {
  display: grid;
  place-items: center;
  min-height: 160px;
  position: relative;
}
.tile-icon { color: var(--clr-text-light); opacity: .9; margin-bottom: .35rem; }
.tile-text { color: var(--clr-text-muted); font-weight: 600; }

/* constrained thumbnail preview (never huge) */
.tile-preview {
  width: 100%;
  height: 140px;            /* thumbnail height */
  object-fit: contain;      /* keep full image visible */
  background: #0c0f19;
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  display: none;            /* becomes visible after selection */
}

/* hide icon/text once an image is present */
.cam-tile.has-image .tile-icon,
.cam-tile.has-image .tile-text { display: none; }

.capture-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .6rem;
}
.compress-toggle { display: inline-flex; align-items: center; gap: .5rem; color: var(--clr-text-muted); }

.muted-note { color: var(--clr-text-muted); display: block; margin-top: .5rem; }

/* Ensure decorative overlays never intercept clicks */
.hero::before,
.feature::before { pointer-events: none; }

/* tiny phones: stack tiles */
@media (max-width: 520px) {
  .tile-row { grid-template-columns: 1fr; }
}

/* Retake badge (visible only when an image exists) */
.retake-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: .35rem .6rem;
  font-size: .85rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.15);
  color: var(--clr-text-light);
  border: 1px solid var(--clr-accent-1);
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
  opacity: 0;
  pointer-events: none; /* hidden by default */
}
.retake-badge:hover {
  transform: translateY(-1px);
  background: rgba(0, 240, 255, 0.25);
}

/* when we actually have an image, show the badge */
.cam-tile.has-image .retake-badge {
  opacity: 1;
  pointer-events: auto;
}

/* --- Toasts (import confirmations) --- */
.toast-container {
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  pointer-events: none; /* clicks pass through except on the toast itself */
}
.toast {
  background: #13222f;
  color: #eaf6ff;
  border: 1px solid #1f3b52;
  border-left: 6px solid var(--clr-accent-1);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  padding: .9rem 1rem;
  border-radius: 10px;
  min-width: 260px;
  max-width: min(92vw, 460px);
  font-size: .95rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: auto;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left-color: #12d2d2; }
.toast.error   { border-left-color: #ff4d7f; }
.toast .t-title { font-weight: 700; margin-bottom: .25rem; }
.toast .t-meta  { font-size: .85rem; color: #a6c2d5; margin-top: .25rem; }
