/* ============================================
   Andrei's Project Diary — Stylesheet
   Matches design system of ai-project site
   ============================================ */

:root {
  /* Default "Classic Navy". Theme classes on <body> override these. */
  --navy: #1a2340;
  --teal: #048A81;
  --teal-dark: #036a63;
  --white: #ffffff;
  --bg: #ffffff;
  --surface: #ffffff;
  --heading: #1a2340;
  --light: #F4F6F9;
  --amber: #F5A623;
  --amber-dark: #d8901a;
  --text: #2a2a2a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #2e7d32;
  --green-tint: #e8f5e9;
  --amber-tint: #fff8e1;
  --gray: #757575;
  --gray-tint: #eeeeee;
  --red: #c0392b;
  --shadow: 0 2px 8px rgba(26, 35, 64, 0.08);
  --shadow-lg: 0 8px 24px rgba(26, 35, 64, 0.12);
  --radius: 8px;
  --radius-btn: 6px;
}

/* ============================================
   THEMES
   ============================================ */
body.theme-midnight {
  --navy: #14192E;
  --teal: #00D9FF;
  --teal-dark: #00B5DC;
  --white: #E7ECF3;
  --bg: #0A0F1F;
  --surface: #14192E;
  --heading: #F5F7FA;
  --light: #1A2140;
  --amber: #F5A623;
  --amber-dark: #d8901a;
  --text: #E7ECF3;
  --muted: #8892B0;
  --border: #243049;
  --green: #4ade80;
  --green-tint: #13321f;
  --amber-tint: #3a2e10;
  --gray: #8892B0;
  --gray-tint: #1a2140;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.55);
}

body.theme-forest {
  --navy: #1E4D2B;
  --teal: #2E7D52;
  --teal-dark: #1E5638;
  --white: #ffffff;
  --bg: #FAF6F0;
  --surface: #ffffff;
  --heading: #1E4D2B;
  --light: #F0EAD6;
  --amber: #E27D60;
  --amber-dark: #C46446;
  --text: #2D2A26;
  --muted: #6B6358;
  --border: #E5DDD0;
  --green: #2E7D52;
  --green-tint: #e0eed3;
  --amber-tint: #faead5;
  --gray: #8a8275;
  --gray-tint: #ece5d3;
  --shadow: 0 2px 8px rgba(45, 42, 38, 0.08);
  --shadow-lg: 0 8px 24px rgba(45, 42, 38, 0.14);
}

body.theme-aurora {
  --navy: #2D3436;
  --teal: #6C5CE7;
  --teal-dark: #5547C7;
  --white: #ffffff;
  --bg: #ffffff;
  --surface: #ffffff;
  --heading: #2D3436;
  --light: #F7F5FF;
  --amber: #FD79A8;
  --amber-dark: #E662A0;
  --text: #2D3436;
  --muted: #636E72;
  --border: #E5E0F5;
  --green: #00B894;
  --green-tint: #d6f4ec;
  --amber-tint: #fde6f0;
  --gray: #636E72;
  --gray-tint: #ecebf3;
  --shadow: 0 2px 8px rgba(108, 92, 231, 0.10);
  --shadow-lg: 0 8px 24px rgba(108, 92, 231, 0.16);
}

body.theme-mono {
  --navy: #0F1115;
  --teal: #0F1115;
  --teal-dark: #000000;
  --white: #ffffff;
  --bg: #ffffff;
  --surface: #FAFAFA;
  --heading: #0F1115;
  --light: #F0F1F3;
  --amber: #FFD60A;
  --amber-dark: #E5C209;
  --text: #0F1115;
  --muted: #5A6373;
  --border: #E4E7EC;
  --green: #0F1115;
  --green-tint: #ededed;
  --amber-tint: #fff8d6;
  --gray: #5A6373;
  --gray-tint: #ECEDEF;
  --shadow: 0 2px 8px rgba(15, 17, 21, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 17, 21, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  padding-top: 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.25s ease, color 0.25s ease;
}

main { flex: 1; }

h1, h2, h3, h4 {
  font-family: "Syne", "Inter", sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--heading);
}

h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 1rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }

p { margin-bottom: 0.8rem; }

a { color: var(--teal); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--teal-dark); }

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  background: var(--navy);
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-title {
  color: var(--white);
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 24px;
}

.nav-links a {
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 0;
  position: relative;
}

.nav-links a:hover { color: var(--amber); }

.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: -6px; left: 0; right: 0;
  height: 3px; background: var(--teal); border-radius: 2px;
}

.owner-chip {
  display: none;
  background: var(--teal);
  color: var(--white);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
}

.lock-btn {
  display: none;
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: "Inter", sans-serif;
}

.lock-btn:hover { background: rgba(255,255,255,0.2); }

body.owner-on .owner-chip,
body.owner-on .lock-btn { display: inline-flex; align-items: center; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--surface);
  margin: 5px 0;
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav-right {
    position: absolute;
    top: 64px; right: 0; left: 0;
    background: var(--navy);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav-right.open { max-height: 500px; padding-bottom: 12px; }
  .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .nav-links a.active::after { display: none; }
  .nav-links a.active { background: rgba(4, 138, 129, 0.15); border-left: 3px solid var(--teal); }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--navy);
  color: var(--white);
  padding: 28px 24px;
  margin-top: 60px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
}

.footer-left a {
  color: var(--amber);
}

.footer-left a:hover { color: var(--white); }

.footer-center { flex: 1; text-align: center; }

.lock-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  font-size: 16px;
  opacity: 0.75;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: opacity 0.2s, background 0.2s;
}

.lock-icon:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 40px 0; }
section.bg-light { background: var(--light); }

.page-header {
  background: linear-gradient(135deg, var(--navy) 0%, #0f1729 100%);
  color: var(--white);
  padding: 60px 24px 40px;
  text-align: center;
}

.page-header h1 { color: var(--white); margin-bottom: 8px; }

.page-header p {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  max-width: 700px;
  margin: 0 auto;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-block;
  padding: 11px 24px;
  background: var(--teal);
  color: var(--white);
  border: 2px solid var(--teal);
  border-radius: var(--radius-btn);
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--teal);
}

.btn-outline:hover {
  background: var(--teal);
  color: var(--white);
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
}

.btn-danger:hover {
  background: #962d22;
  border-color: #962d22;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* ============================================
   DASHBOARD
   ============================================ */
.progress-section {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--text);
}

.progress-label strong { color: var(--heading); }

.progress-track {
  background: var(--light);
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal) 0%, #06b09f 100%);
  border-radius: 7px;
  width: 0;
  transition: width 1s ease-out;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 700px) {
  .stats-row { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 4px solid var(--teal);
}

.stat-card:nth-child(2) { border-top-color: var(--amber); }
.stat-card:nth-child(3) { border-top-color: var(--heading); }

.stat-num {
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 2.4rem;
  color: var(--heading);
  line-height: 1;
}

.stat-lbl {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 800px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.info-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.info-card h3 {
  color: var(--heading);
  font-family: "Syne", sans-serif;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.entry-date {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.entry-title {
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 6px;
}

.entry-preview {
  color: var(--text);
  font-size: 0.93rem;
  margin-bottom: 12px;
}

.upnext-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.upnext-item:last-child { border-bottom: none; }

.upnext-task { color: var(--text); font-size: 0.93rem; flex: 1; }
.upnext-date { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }

.dashboard-cta {
  text-align: center;
  margin-top: 12px;
}

.muted-link {
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 500;
}

.empty-line {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* ============================================
   LOG ENTRIES
   ============================================ */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}

.log-entry {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
  position: relative;
}

.log-entry .date {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
  font-weight: 500;
}

.log-entry h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.log-content {
  white-space: pre-line;
  color: var(--text);
  font-size: 0.96rem;
}

.entry-actions {
  display: none;
  margin-top: 16px;
  gap: 8px;
}

body.owner-on .entry-actions { display: flex; }

/* ============================================
   TASK TABLE
   ============================================ */
.tasks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.tasks-toolbar .add-task-btn { display: none; }
body.owner-on .tasks-toolbar .add-task-btn { display: inline-block; }

.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.tasks-table th,
.tasks-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  vertical-align: top;
}

.tasks-table th {
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.78rem;
  position: sticky;
  top: 0;
}

.tasks-table tr:nth-child(even) td { background: var(--light); }
.tasks-table tr:hover td { background: #eef3f7; }

.tasks-table td.date-cell { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.tasks-table td.task-cell { font-weight: 500; color: var(--text); }
.tasks-table td.notes-cell { color: var(--muted); font-style: italic; max-width: 200px; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-done { background: var(--green-tint); color: var(--green); }
.status-progress { background: var(--amber-tint); color: var(--amber-dark); }
.status-todo { background: var(--gray-tint); color: var(--gray); }

body.owner-on .status-badge {
  cursor: pointer;
  transition: transform 0.15s;
}
body.owner-on .status-badge:hover { transform: scale(1.05); }

.row-actions {
  display: none;
  gap: 6px;
}

body.owner-on .row-actions { display: flex; }

.task-progress-summary {
  margin-top: 16px;
  text-align: right;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ============================================
   FAB (floating add button)
   ============================================ */
.fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: 28px;
  padding: 14px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(4, 138, 129, 0.4);
  z-index: 800;
  font-family: "Inter", sans-serif;
}

.fab:hover { background: var(--teal-dark); }

body.owner-on .fab { display: inline-block; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 31, 0.7);
  z-index: 3000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal.small { max-width: 380px; }

.modal h3 {
  font-size: 1.3rem;
  margin-bottom: 18px;
  color: var(--heading);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-family: "Inter", sans-serif;
  font-size: 0.94rem;
  background: var(--surface);
  color: var(--text);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(4, 138, 129, 0.15);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.pin-input {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 6px;
  font-family: "Syne", sans-serif;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

.shake { animation: shake 0.4s ease-in-out; }

.error-text {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 6px;
  text-align: center;
  display: none;
}

.error-text.show { display: block; }

/* ============================================
   ABOUT PAGE
   ============================================ */
.about-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.about-card h2 { margin-bottom: 16px; }

.info-list {
  list-style: none;
  margin-bottom: 16px;
}

.info-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  font-size: 0.95rem;
}

.info-list li:last-child { border-bottom: none; }

.info-list .key {
  font-weight: 600;
  color: var(--heading);
  min-width: 160px;
}

.note-box {
  background: var(--amber-tint);
  border-left: 4px solid var(--amber);
  padding: 14px 18px;
  border-radius: 4px;
  font-size: 0.92rem;
  color: var(--text);
  margin-top: 12px;
}

/* ============================================
   THEME SWITCHER (footer)
   ============================================ */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-switcher .ts-label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
  margin-right: 4px;
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.theme-swatch:hover {
  transform: scale(1.12);
  border-color: rgba(255, 255, 255, 0.7);
}

.theme-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.theme-swatch.active::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
