/* ==================== Root Variables ==================== */
:root {
  --accent: #00b894;
  --accent-hover: #009e7a;

  --bg-dark: #3a3f3d;        /* Gunmetal */
  --bg-darker: #121212;      /* Optional depth/hover */
  --bg-darkmode: #5a605a;    /* Charcoal Grey */
  --bg-light: #eef7f1;       /* Mint green */

  --text-dark: #23272f;
  --text-light: #f8f9fa;

  --card-bg-dark: rgba(255,255,255,0.07);
  --card-bg-light: #fff;

  --card-border-dark: rgba(255,255,255,0.05);
  --card-border-light: #e0e0e0;

  --cancel: #5c6f7b;
  --cancel-hover: #3e4f59;
}

/* ==================== Logo Helpers ==================== */
.logo-img {
  width: 150px;
  height: 150px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.hero-header {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.hero-header .logo-img {
  width: 150px;
  height: 150px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  margin-bottom: 1.5rem;
}

.hero-header h1 {
  margin-bottom: 0.75rem;
}

.hero-header p.lead {
  margin-bottom: 2rem;
}

/* ==================== Text Styles ==================== */
.text-accent {
  color: var(--accent) !important;
}

/* ==================== Base Styles ==================== */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
  padding-top: 70px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex-grow: 1;
}

@media (max-width: 991.98px) {
  body {
    padding-top: 60px;
  }
}

/* ==================== Page Headers ==================== */
.page-header {
  padding-top: 100px;
  padding-bottom: 2rem;
  min-height: 80vh;
  background: linear-gradient(120deg, #3a3f3d 60%, var(--accent) 100%);
  color: var(--text-light);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipes-header {
  background: linear-gradient(120deg, var(--bg-dark) 60%, var(--accent) 100%);
  color: var(--text-light);
  padding-top: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--accent);
}

.recipes-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0;
}

@media (max-width: 991.98px) {
  .page-header {
    padding-top: 80px;
  }
}

/* ==================== Typography ==================== */
h1, h2, h3, .card-title {
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

body,
.card-text,
.list-group-item {
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ==================== Navbar ==================== */
.navbar {
  background-color: var(--bg) !important;
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 1030;
}

.navbar .navbar-brand {
  font-weight: 700;
  letter-spacing: 1px;
  z-index: 2;
}

.nav-link {
  color: var(--text);
}

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

@media (max-width: 991.98px) {
  .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }
}

.navbar-brand-logo {
  height: 40px;
  width: auto;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Theme toggle button */
#theme-toggle {
  border-color: var(--accent);
  color: var(--accent);
}

#theme-toggle:hover {
  background: var(--accent);
  color: #fff;
}

/* Navbar toggler */
body.light-theme .navbar-toggler,
body.dark-theme .navbar-toggler {
  border-color: var(--accent);
}

body.light-theme .navbar-toggler-icon,
body.dark-theme .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' fill='%2300b894' class='bi bi-list' viewBox='0 0 16 16'><path fill-rule='evenodd' d='M2.5 12.5a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1h-10a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1h-10a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1h-10a.5.5 0 0 1-.5-.5z'/></svg>");
}

/* ==================== Footer (global) ==================== */
footer {
  background-color: var(--bg) !important;
  color: var(--text);
  border-top: 2px solid var(--accent);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

/* ==================== Components: Cards ==================== */
.card {
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  color: var(--text);
  border: 1px solid var(--card-border);
  transition: transform 0.15s;
}

.card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

/* ==================== Forms & Buttons ==================== */
.form-select:focus,
.form-control:focus {
  border-color: var(--accent);
  box-shadow: none;
}

.btn-outline-light,
.btn-outline-light:focus {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn-outline-light:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(0,184,148,0.3);
}

.btn-outline-light:active {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Base form control styling (theme-aware) */
.form-control,
.form-select {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
}

.form-control::placeholder {
  color: var(--text);
  opacity: 0.6;
}

/* ==================== Theme: Dark & Light ==================== */
body {
  background: var(--bg);
  color: var(--text);
}

/* Theme variables */
body.light-theme {
  --bg: var(--bg-light);
  --text: var(--text-dark);

  --card-bg: var(--card-bg-light);
  --card-border: var(--card-border-light);

  --sidebar-bg: var(--card-bg-light);
  --sidebar-text: var(--text-dark);

  --spinner-border: var(--card-bg-light);
}

body.dark-theme {
  --bg: var(--bg-darkmode);
  --text: var(--text-light);

  --card-bg: var(--card-bg-dark);
  --card-border: var(--card-border-dark);

  --sidebar-bg: var(--card-bg-dark);
  --sidebar-text: var(--text-light);

  --spinner-border: var(--card-bg-dark);
}

/* Shared themed components */
.card,
.recipe-background {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  box-shadow: 0 4px 24px rgba(0,0,0,0.18),
              0 1.5px 6px rgba(0,0,0,0.12);
}

.recipe-background {
  background-color: var(--bg);
  color: var(--text);
}

/* Typography under theme */
.card-title,
.card-text,
.theme-text {
  color: var(--text);
}

/* Form controls under theme */
body.dark-theme .form-control,
body.dark-theme .form-select,
body.light-theme .form-control,
body.light-theme .form-select {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
}

/* Labels */
.theme-label {
  color: var(--text);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* ==================== Navbar Toggler Fix (already themed) ==================== */
/* (kept above in navbar section) */

/* ==================== Utilities ==================== */
.hero-fade-in {
  animation: fadeIn 1.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: none; }
}

.headroom {
  transition: transform 0.3s ease-in-out;
}

.headroom--unpinned {
  transform: translateY(-100%);
}

.headroom--pinned {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ==================== Sidebar (Theme-Aware) ==================== */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  width: 240px;
  padding: 1rem;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1020;
}

.main-content {
  margin-left: 240px;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }
}

/* ==================== Loading Spinner Utility ==================== */
.loading-spinner {
  border: 4px solid var(--spinner-border);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  animation: spin 0.8s linear infinite;
}

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

/* ==================== Keyboard Navigation ==================== */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==================== Theme Transition ==================== */
body.theme-transition {
  transition: background 0.3s ease, color 0.3s ease;
}

/* ==================== AI Panel ==================== */
.ai-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--bg);
  color: var(--text);
  padding: 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1050;
}

/* ==================== Footer in base.html ==================== */
.site-footer {
  background-color: var(--bg);
  color: var(--text);
  border-top: 2px solid var(--accent);
  font-size: 0.95rem;
  text-align: center;
}

.footer-logo {
  height: 32px;
  width: auto;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.credit-logo {
  height: 20px;
  width: auto;
  vertical-align: middle;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ==================== Recipe Page: Mobile Action Bar ==================== */
@media print {
  .no-print {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .btn-toolbar.sticky-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    padding: 0.5rem 1rem;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
    z-index: 1000;
  }
}

/* ==================== About Page Carousel ==================== */
#family-carousel .carousel-item img {
  max-height: 600px;
  object-fit: cover;
  width: 100%;
}
