/* ==================================== */
/* 1. DESIGN TOKENS (VARIABLES)         */
/* ==================================== */
:root {
  /* Brand Colors */
  --color-primary: #3368a0;
  --color-primary-dark: #203661;
  --color-primary-light: #5f96d1;
  --color-accent: #13579f;
  --color-accent-hover: #f1a12a;
  --color-accent-amber: #c17c15;

  /* Background Colors (Light Mode Defaults) */
  --bg-body: #3368a0;
  --bg-nav: #3368a0;
  --bg-container: #3368a0;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-suggestion: #203661;
  --bg-footer: rgba(255, 255, 255, 0.95);
  --bg-modal-overlay: rgba(0, 0, 0, 0.7);
  --bg-modal-content: rgba(19, 87, 159, 0.7);

  /* Text Colors (Light Mode Defaults) */
  --text-main: #ffffff;
  --text-heading: #fcfdfc;
  --text-muted: #363535;
  --text-dark: #090909; /* Used for inputs */
  --text-black: #000000;
  --text-gray: #4f5154;
  --text-footer: #292727;
  --text-on-dark: #f7f7f9;
  --text-input-placeholder: #757575;

  /* Feedback Colors */
  --color-success: #04d361;
  --color-success-dark: #0dbd6a;
  --color-error: #fa3e4d;
  --color-error-hover: #ff4757;
  --color-delete: #ff4d4d;

  /* UI Elements */
  --border-light: #e4e6eb;
  --border-dark: #29292e;
  --shadow-heavy: rgba(0, 0, 0, 0.7);
  --shadow-medium: rgba(0, 0, 0, 0.3);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
}

/* 🌙 DARK MODE VARIABLES SWAP */
body.dark-mode {
  --bg-body: #000000;
  --bg-nav: #000000;
  --bg-container: #0b1d32;
  --bg-card: #0b1d32;
  --bg-input: #000000;
  --bg-modal-content: #0b1d32;
  --text-dark: #ffffff; /* Makes typed text white */
  --text-input-placeholder: #a0a0a0;
  --border-dark: #444444; /* Visible input borders */
}

/* ==================================== */
/* 2. GLOBAL STYLES                     */
/* ==================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background-color: var(--bg-body);
  color: var(--text-main);
  padding: 20px 20px 80px 20px;
  transition:
    background-color 0.3s,
    color 0.3s; /* Smooth dark mode swap */
}

main {
  margin-top: 80px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  text-align: center;
  color: var(--text-heading);
}

h2 {
  color: var(--text-main);
}

ul {
  list-style-type: none;
  margin-bottom: 25px;
}

li {
  position: relative;
  margin-top: 10px;
  margin-left: 25px;
  margin-bottom: 12px;
  font-size: 15px;
  text-align: left;
  color: var(--text-main);
}

/* ==================================== */
/* 3. NAVIGATION BAR                    */
/* ==================================== */
.custom-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  background-color: var(--bg-nav);
  padding: 0 20px;
  position: fixed;
  top: 0;
  left: 50%;
  height: 130px;
  transform: translateX(-50%);
  z-index: 1000;
  width: 100%;
  max-width: 850px;
  border-radius: 0px 0px 5px 5px;
  transition: background-color 0.3s;
}

.logo {
  flex: 0 1 375px;
  width: 100%;
  max-width: 375px;
  min-width: 0;
  display: flex;
  align-items: center;
}

.logo-link {
  display: block;
  width: 100%;
}

.logo-link img {
  width: 100%;
  height: 75px;
  object-fit: contain;
  display: block;
}

/* Dark Mode Logo Handling */
.logo-link img.logo-dark {
  display: none;
}
.logo-link img.logo-light {
  display: block;
}
body.dark-mode .logo-link img.logo-light {
  display: none;
}
body.dark-mode .logo-link img.logo-dark {
  display: block;
}

.hamburger,
.toggle-container-vertical {
  flex-shrink: 0;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--color-accent-hover);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
}

.hamburger .bar {
  height: 3px;
  width: 100%;
  background-color: var(--text-main);
  border-radius: 5px;
  transition: all 0.3s ease;
}

/* ==================================== */
/* 4. MAIN CONTAINERS                   */
/* ==================================== */
/* Consolidated identical container styles */
.container,
.todo-container,
.doc-container,
.privacy-container,
.terms-conditions,
.about-container,
#form {
  position: relative;
  margin-top: 150px;
  background-color: var(--bg-container);
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px var(--shadow-heavy);
  max-width: 800px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  transition: background-color 0.3s;
}

/* Adjustments for centered containers */
.container,
.todo-container,
.doc-container,
.about-container {
  text-align: center;
}

.about p {
  padding: 10px;
}

#form {
  margin-top: 200px;
}
.heading-paragraph {
  margin-top: 15px;
}
.privacy-container p,
.terms-conditions p {
  margin: 10px auto;
}

/* ==================================== */
/* 5. TODO LOGIC & INPUT STYLING        */
/* ==================================== */
.input-section,
.add-suggestion-to-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

/* Input Fields - Variables handle dark mode natively now */
input,
textarea,
select,
#todo-input,
#new-category-name,
.suggestion-input {
  flex: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-dark);
  color: var(--text-dark);
  caret-color: var(--text-dark);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  outline: none;
  transition:
    background-color 0.3s,
    color 0.3s,
    border-color 0.3s;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-input-placeholder);
}

#todo-input:focus,
.suggestion-input:focus {
  border-color: var(--color-success);
}

/* Buttons */
#add-btn,
#create-category-btn,
.add-suggestion-btn,
.card-header {
  background-color: var(--color-accent);
  border: none;
  color: var(--text-main);
  padding: 0 20px;
  border-radius: var(--radius-sm);
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  text-align: center;
  transition: background-color 0.2s;
  cursor: default;
}

#create-category-btn {
  border: solid 1px var(--color-primary-dark);
}

.finish-btn,
.submit-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background-color: var(--color-accent-amber);
  border: 1px solid var(--border-dark);
  color: #ffffff; /* Keeps text white for contrast against amber */
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: background-color 0.2s;
}

#add-btn:hover,
#create-category-btn:hover,
.add-suggestion-btn:hover,
.finish-btn:hover,
.submit-btn:hover {
  background-color: var(--color-primary-light);
}

/* Suggestion Layout */
.add-suggestion-to-group {
  align-items: center;
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
}

.add-suggestion-btn {
  margin-left: auto;
  flex-shrink: 0;
  height: 36px;
  width: 70px;
  align-self: center;
  box-sizing: border-box;
  padding: 0;
  text-align: center;
}

.suggestion-input {
  height: 36px;
  box-sizing: border-box;
  margin-right: 10px;
}

/* Suggestions Box */
.suggestions-container {
  margin-bottom: 12px;
  background-color: var(--bg-suggestion);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dark);
}

.suggestions-title {
  font-size: 0.8rem;
  color: var(--text-on-dark);
  text-align: left;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-chip {
  background-color: var(--color-primary);
  color: #e1e1e6;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  margin-bottom: 5px;
}

.suggestion-chip:hover {
  background-color: var(--color-primary-light);
  color: var(--text-main);
}

.chip-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: 8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background-color: var(--text-main);
  color: var(--color-error);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.chip-delete-btn:hover {
  background-color: var(--color-error);
  color: var(--text-main);
}

/* To-Do List Items */
#todo-list {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 15px;
  padding: 5px;
}

.todo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--color-primary);
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  animation: fadeIn 0.3s ease;
  color: var(--text-main);
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.delete-btn,
.delete-category-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: bold;
}

.delete-btn {
  color: var(--color-error);
  font-size: 1.2rem;
  padding: 0 5px;
}

.delete-category-btn {
  color: var(--color-delete);
  font-size: 1.5rem;
  transition: transform 0.2s;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================================== */
/* 6. INSTRUCTIONAL / CONTENT CARDS     */
/* ==================================== */
.task-container {
  margin-top: 50px; /* Overrides the 150px default */
}

.key-features,
.privacystorage,
.consent,
.advert-info,
.logs-cookies h2,
.logs-cookies p {
  padding: 10px 0;
}

.subtitle,
.date {
  color: var(--text-on-dark);
  font-size: 16px;
  margin: 20px auto;
}

.getting-started ol li,
.core-features ol li {
  list-style: decimal;
  padding-left: 5px;
}

.card strong {
  color: var(--text-heading);
  display: block;
  margin-bottom: 5px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
}

.google-link,
.advertising-partners li {
  color: var(--color-success-dark);
  font-size: 18px;
}

/* ==================================== */
/* 7. DARK MODE TOGGLE (SWITCH)         */
/* ==================================== */
.toggle-container-vertical {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.toggle-label-top {
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.toggle-label-bottom {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: '';
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #3672f1;
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* ==================================== */
/* 8. FOOTER & MODALS                   */
/* ==================================== */
footer {
  margin-top: 20px;
  text-align: center;
}

.copyright,
.copyright a {
  color: orange;
  font-size: 1rem;
  text-decoration: none;
}
.copyright a {
  margin: 0 10px;
}
.copyright a:hover {
  color: var(--color-accent-amber);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-modal-overlay);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--bg-modal-content);
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 450px;
  display: flex;
  flex-direction: column;
  min-height: 50vh;
  max-height: 85vh;
  box-shadow: 0 10px 30px var(--shadow-medium);
  animation: popIn 0.3s ease-out;
  transition: background-color 0.3s;
}

/* Modals Scoped specificity instead of !important */
.modal-content ul.modal-todo-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  margin: 0;
  width: 100%;
}

.modal-content .todo-item {
  width: 100%;
  max-width: 450px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 10px;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==================================== */
/* 9. PRIVACY & CONSENT COMPONENTS      */
/* ==================================== */
.tb-priv-hidden-view {
  display: none;
}

.tb-priv-banner-frame {
  background-color: var(--bg-card);
  border: 1px solid #e0e0e0;
  box-shadow: 0 10px 30px var(--shadow-light);
  border-radius: var(--radius-md);
  padding: 20px;
  z-index: 999999;
}

.tb-priv-banner-content p {
  color: #444444;
}
.tb-priv-banner-content a {
  color: #0066cc;
}

.tb-priv-btn-secondary {
  background-color: #f1f1f1;
  color: #555555;
}
.tb-priv-btn-primary {
  background-color: #0066cc;
  color: var(--text-main);
}
.tb-priv-btn-save {
  background: #28a745;
  color: white;
}

/* ==================================== */
/* 10. MEDIA QUERIES                    */
/* ==================================== */

/* Tablet (768px and down) */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .custom-navbar {
    height: auto;
    padding: 15px 20px;
  }

  /* Consolidating logo rules across all mobile viewports */
  .logo-link img {
    width: 90%;
    height: auto;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-primary-dark);
    padding: 1.5rem;
    gap: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow-light);
    border-radius: 0 0 5px 5px;
  }

  .nav-links.active {
    display: flex;
  }

  .hamburger.active .bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
  }
  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }
  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
  }
}

/* General Mobile (600px and down) */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Small Phones (480px and down) */
@media (max-width: 480px) {
  .tb-priv-banner-buttons {
    flex-direction: column-reverse;
  }
  .tb-priv-btn {
    width: 100%;
  }
}

/* Extra Small (450px and down) */
@media screen and (max-width: 450px) {
  .input-section,
  .add-suggestion-to-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .add-suggestion-to-group .suggestion-input,
  .add-suggestion-to-group .add-suggestion-btn {
    width: 100%;
    box-sizing: border-box;
  }

  .custom-navbar {
    gap: 5px;
    padding: 8px 10px;
  }

  .privacystorage p {
    text-align: center;
    margin-top: 10px;
  }

  #add-btn,
  #create-category-btn,
  .add-suggestion-btn {
    background-color: #07478a;
    padding: 10px;
  }
}

/* Document Text Colors (Privacy & Terms) */
.privacy-container,
.privacy-container h1,
.privacy-container h2,
.privacy-container p,
.privacy-container li,
.terms-conditions,
.terms-conditions h1,
.terms-conditions h2,
.terms-conditions p,
.terms-conditions li {
  color: var(--text-dark);
}

/* ==================================== */
/* 6. INSTRUCTIONAL / CONTENT CARDS     */
/* ==================================== */

/* Give the main container and cards a clean background */
.task-container,
.card {
  background-color: var(--bg-container);
  box-shadow: 0 4px 20px var(--shadow-heavy);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 850px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  transition: background-color 0.3s;
}

/* Specific styling for smaller cards */
.card {
  padding: 15px;
  margin: 10px auto;
  border-radius: 10px;
}

/* Force ALL text inside the instructions page to use the adapting text variable */
.about-container h1,
.task-container,
.task-container h1,
.task-container h2,
.task-container h3,
.task-container p,
.task-container li,
.task-container .subtitle,
.card,
.card h2,
.card h3,
.card p,
.card li,
.card strong {
  color: var(--text-dark);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
}
