:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #222;
  --text-light: #777;
  --accent: #5773ff;
  --border: #e4e6eb;
  --radius: 8px;
  --transition: 0.18s ease;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-container {
  width: 100%;
  max-width: 880px;
  margin: auto;
  padding: 2rem 1.5rem;
}

/* subtle fade */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.5s forwards ease-out;
}

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


/* Guided mode layout reset */
.guided-wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Hide workspace until JS activates it */
.guided-workspace {
  display: none;
}

/* Only show workspace after flow JS toggles class */
.guided-wrapper.show-workspace .guided-workspace {
  display: block;
}

/* When workspace shown, hide guided panels */
.guided-wrapper.show-workspace .flow-panel {
  display: none;
}

/* Guided nav softer */
body .nav {
  background: #fff;
  border-bottom: 1px solid #eee;
}
body .nav a {
  color: #111;
  font-weight: 500;
}

/* Optional: hide footer for guided mode for cleanliness */
footer { display: none; }


.case-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 6px;
  background: #f4f4f4;
}

.placeholder-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 6px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-tile {
  position: relative;
  padding-bottom: 8px;
}

.case-delete-form {
  margin-top: 6px;
  text-align: right;
}

.delete-btn.small {
  font-size: 12px;
  padding: 4px 8px;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.delete-btn.small:hover {
  background: #e14545;
  color: #fff;
  border-color: #c22;
}


.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: #777;
  border-top: 1px solid #e5e5e5;
  padding: 1rem 0;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-link {
  color: #777;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #000;
}

.divider {
  color: #bbb;
}

/* --------------------------- */
/* Global responsive tweaks    */
/* --------------------------- */
@media (max-width: 600px) {
  .footer {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .guided-wrapper {
    padding: 1.25rem 1rem;
  }

  .app-container {
    padding: 1.5rem 1rem;
  }
}
/* --------------------------- */
/* Global responsive tweaks    */
/* --------------------------- */
@media (max-width: 600px) {
  .footer {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .guided-wrapper {
    padding: 1.25rem 1rem;
  }

  .app-container {
    padding: 1.5rem 1rem;
  }
}






/* --------------------------- */
/* Responsive Navigation       */
/* --------------------------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  position: relative;
  z-index: 10;
}

.nav-left a.nav-logo,
.nav-left span.nav-logo {
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-right a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-right a:hover {
  color: var(--accent);
}

/* Toggle hidden on desktop */
.nav-toggle {
  display: none;
  font-size: 1.4rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
}



/* --------------------------- */
/* Global overflow protection  */
/* --------------------------- */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Ensure container doesn’t exceed screen on mobile */
.app-container {
  box-sizing: border-box;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

@media (max-width: 600px) {
  .app-container {
    padding: 1.25rem 1rem;
  }
}

/* Prevent any rogue flex or grid items from stretching wider */
* {
  box-sizing: border-box;
}
@media (max-width: 700px) {
  .nav {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: block;
  }

  .nav-right {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    padding: 0.75rem 0;
  }

  .nav-right.show {
    display: flex;
  }

  .nav-right a {
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }

  .nav-right a.muted.small {
    font-size: 0.9rem;
    color: var(--text-light);
  }
}


/* -----------------------------
   THEME: DARK MODE
----------------------------- */
body.theme-dark {
  background: #111;
  color: #eee;
}

body.theme-dark .card,
body.theme-dark nav,
body.theme-dark footer {
  background: #1a1a1a;
  color: #eee;
  border-color: #333;
}

body.theme-dark a {
  color: #9ecbff;
}
body.theme-dark a:hover {
  color: #cfe6ff;
}

/* -----------------------------
   THEME: HIGH CONTRAST
----------------------------- */
body.theme-contrast {
  background: #000;
  color: #fff;
}
body.theme-contrast .card,
body.theme-contrast nav,
body.theme-contrast footer {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
}
body.theme-contrast a {
  color: #ffea00;
}

/* -----------------------------
   TEXT SIZE
----------------------------- */
body.text-large {
  font-size: 1.15em;
  line-height: 1.8;
}

body.text-large h1,
body.text-large h2,
body.text-large h3 {
  line-height: 1.3;
}

/* ===============================
   Sticky Footer — Corrected Version
================================= */

/* Reset global structure */
html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
}

/* Let main content grow and leave room for footer */
main.app-container,
.workspace-container {
  flex: 1;
  padding-bottom: 70px; /* reserve footer space */
  box-sizing: border-box;
}

/* Footer sits at the bottom but doesn’t overlay content */
.footer {
  position: relative; /* no longer fixed */
  bottom: 0;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  z-index: 10;
}

/* Footer links */
.footer-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-link {
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.footer-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Dark / contrast modes */
body.theme-dark .footer {
  background: #181818;
  color: #ddd;
  border-top-color: #333;
}
body.theme-contrast .footer {
  background: #000;
  color: #fff;
  border-top: 2px solid #fff;
}
.nav-logo-img {
  height: 75px;            /* sweet spot for a 60px navbar */
  width: auto;
  max-height: 48px;
  max-width: 180px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.4rem;
  filter: brightness(0.75) contrast(1.2) saturate(0);
  transition: filter 0.2s ease, opacity 0.2s ease;
}

/* On smaller screens, scale down slightly */
@media (max-width: 600px) {
  .nav-logo-img {
    height: 36px;
    max-height: 40px;
    max-width: 150px;
  }
}

/* Dark + contrast adjustments */
body.theme-dark .nav-logo-img {
  filter: brightness(3) saturate(0%);
}
body.theme-contrast .nav-logo-img {
  filter: invert(1);
}
.modal-overlay {
  pointer-events: none;
}
.modal-overlay[style*="display: flex"] {
  pointer-events: all;
}
