/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&family=DM+Sans:wght@300;400;500&display=swap');

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

body {
  font-family: 'DM Sans', sans-serif;
  background-color: #f0ede4;
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  background-color: #f7f5ef;
  border-radius: 16px;
  padding: 72px 52px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-wordmark {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.wordmark-stubbe {
  color: #1f4a1f;
}

.wordmark-note {
  color: #3a7a3a;
}

.login-input {
  width: 100%;
  height: 50px;
  border-radius: 10px;
  border: 0.5px solid rgba(45, 90, 45, 0.2);
  background-color: #f7f5ef;
  padding: 0 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: #2a2a2a;
  outline: none;
  transition: border-color 0.2s ease;
}

.login-input:focus {
  border-color: #2d5a2d;
}

.login-button {
  width: 100%;
  height: 42px;
  margin-top: 10px;
  border-radius: 10px;
  border: none;
  background-color: #2d5a2d;
  color: #f0ede4;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.login-button:hover {
  background-color: #245224;
}

.login-button:active {
  background-color: #1f4a1f;
}

.login-error {
  font-size: 13px;
  color: #8b4040;
  text-align: center;
  margin-top: -8px;
}

.login-quote {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 300;
  font-style: italic;
  color: #a8b8a8;
  text-align: center;
  max-width: 320px;
  margin: 28px auto 0 auto;
  line-height: 1.7;
  letter-spacing: 0.02em;
  animation: fade-in 0.5s ease both;
}

/* ── Flash messages ────────────────────────────────────── */

.flash {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #1f4a1f;
  color: #f0ede4;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}

.flash--hiding {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

.flash--alert {
  background: #8b4040;
}

.flash--notice {
  background: #1f4a1f;
}

/* ── Noise texture overlay ─────────────────────────────── */

body {
  position: relative;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ── App header ────────────────────────────────────────── */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f7f5ef;
  border-bottom: 0.5px solid #dcd8cc;
  padding: 16px 24px;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1;
}

.app-header-brand svg {
  display: block;
  flex-shrink: 0;
  position: relative;
  top: 4px;
}

.app-header-wordmark {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.logout-button {
  background: none;
  border: none;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #a8b8a8;
  cursor: pointer;
  transition: color 0.15s ease;
}

.logout-button:hover {
  color: #1f4a1f;
}

/* ── Home main ─────────────────────────────────────────── */

.home-main {
  padding-top: 76px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.home-content {
  width: 100%;
  max-width: 560px;
  padding: 56px 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  animation: fade-in 0.4s ease-in both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.home-greeting {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: #a8b8a8;
  letter-spacing: 0.1px;
}

/* ── Folder grid ───────────────────────────────────────── */

.folder-grid {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  grid-template-rows: repeat(2, 120px);
  gap: 16px;
}

.folder-card {
  background-color: #f0ede4;
  border: 0.5px solid #dcd8cc;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  opacity: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, border-width 0.2s ease, opacity 0.4s ease;
}

.folder-card.visible {
  opacity: 1;
}

.folder-card:hover {
  border: 1.5px solid #a8b8a8;
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.folder-card:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

.folder-label {
  font-family: 'Syne', sans-serif;
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: baseline;
}

.folder-label-g {
  color: #1f4a1f;
}

/* ── G page layout ─────────────────────────────────────── */

:root {
  --g-header-h: 57px;
  --g-sidebar-w: 240px;
}

.g-page {
  min-height: 100vh;
  background-color: #f0ede4;
}

.g-header {
  height: var(--g-header-h);
  align-items: center;
}

/* Sidebar */
.g-sidebar {
  position: fixed;
  top: var(--g-header-h);
  left: 0;
  width: var(--g-sidebar-w);
  height: calc(100vh - var(--g-header-h));
  background-color: #f7f5ef;
  border-right: 0.5px solid #dcd8cc;
  transform: translateX(calc(-1 * var(--g-sidebar-w)));
  transition: transform 0.25s ease;
  z-index: 50;
  overflow-y: auto;
}

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

/* Content area */
.g-content {
  position: relative;
  padding-top: var(--g-header-h);
  margin-left: 0;
  transition: margin-left 0.25s ease;
  min-height: 100vh;
}

.g-page.sidebar-open .g-content {
  margin-left: var(--g-sidebar-w);
}

/* Topbar — toggle + section heading in one row */
.g-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 16px 16px;
}

/* Toggle button */
.g-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease;
}

.g-toggle:hover {
  background-color: rgba(220, 216, 204, 0.5);
}

.g-toggle svg {
  transition: transform 0.3s ease;
}

/* Main content */
.g-main {
  padding: 24px 40px 40px 24px;
}

.g-section-heading {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 600;
  color: #1f4a1f;
}

/* Sidebar nav */
.g-nav {
  padding: 12px 0;
}

.g-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #1f4a1f;
  text-align: left;
  border-radius: 8px;
  transition: background-color 0.15s ease;
  box-sizing: border-box;
}

.g-nav-item:hover,
.g-nav-item--active {
  background-color: #f0ede4;
}

.g-nav-label {
  flex: 1;
}

.g-nav-count {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: #a8b8a8;
  min-width: 16px;
  text-align: right;
}

.g-nav-divider {
  height: 0.5px;
  background-color: #dcd8cc;
  margin: 0 16px;
}

/* nav items are now <a> tags — reset link defaults */
a.g-nav-item {
  text-decoration: none;
  color: #1f4a1f;
}

/* ── Search bar ─────────────────────────────────────────── */

.g-search-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.g-sort-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f7f5ef;
  border: 0.5px solid #dcd8cc;
  border-radius: 8px;
  padding: 3px;
}

.g-sort-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #a8b8a8;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 5px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.g-sort-btn--active {
  color: #1f4a1f;
  background-color: #f0ede4;
}

.g-sort-btn:hover:not(.g-sort-btn--active) {
  color: #6b7f6b;
}

.g-search-input {
  width: 100%;
  max-width: 360px;
  height: 38px;
  background: #f7f5ef;
  border: 0.5px solid #dcd8cc;
  border-radius: 8px;
  padding: 0 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #1f4a1f;
  outline: none;
  transition: border-color 0.15s ease;
  appearance: none;
}

.g-search-input:focus {
  border-color: #2d5a2d;
}

.g-search-input::placeholder {
  color: #a8b8a8;
}

/* ── Entry list ─────────────────────────────────────────── */

.g-empty-state {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #a8b8a8;
  text-align: center;
  padding: 60px 0;
}

.g-entry-card {
  position: relative;
  background: #f7f5ef;
  border: 0.5px solid #dcd8cc;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.g-entry-card:hover {
  border-color: #a8b8a8;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.g-entry-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.g-entry-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1f4a1f;
  flex: 1;
  cursor: grab;
}

.g-entry-card.is-dragging .g-entry-title {
  cursor: grabbing;
}

.g-entry-date {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #a8b8a8;
  white-space: nowrap;
  flex-shrink: 0;
}

.g-entry-second {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #6b7f6b;
  margin-bottom: 10px;
}

.g-entry-thoughts {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: #a8b8a8;
  line-height: 1.65;
  height: calc(1.65em * 2);
  overflow: hidden;
  margin: 0;
}

.g-entry-card.is-dragging {
  opacity: 0.5;
}

.g-drag-placeholder {
  height: 2px;
  background: #2d5a2d;
  border-radius: 1px;
  margin: 4px 0;
}

.g-entry-body {
  cursor: pointer;
  user-select: none;
}

.g-entry-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.g-entry-expand--open {
  max-height: 800px;
}

.g-entry-full-thoughts {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: #6b7f6b;
  line-height: 1.7;
  padding: 12px 0 0;
}

.g-entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
}

.g-entry-edit {
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: #a8b8a8;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.g-entry-edit:hover {
  color: #1f4a1f;
}

.g-entry-remove-form {
  margin: 0;
}

.g-entry-remove {
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: #a8b8a8;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.g-entry-remove:hover {
  color: #8b4040;
}

/* ── Header actions ────────────────────────────────────── */

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-settings-link {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #a8b8a8;
  text-decoration: none;
  transition: color 0.15s ease;
}

.header-settings-link:hover {
  color: #1f4a1f;
}

/* ── Settings page ──────────────────────────────────────── */

.settings-card {
  background: #f7f5ef;
  border: 0.5px solid #dcd8cc;
  border-radius: 16px;
  padding: 36px 40px;
  max-width: 480px;
}

.settings-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1f4a1f;
  margin-bottom: 24px;
}

.settings-notice {
  font-size: 13px;
  color: #3a7a3a;
  margin-bottom: 16px;
}

.settings-error {
  font-size: 13px;
  color: #8b4040;
  margin-bottom: 16px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.settings-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: #a8b8a8;
  letter-spacing: 0.08em;
}

.settings-input {
  background: #f0ede4;
  border: 0.5px solid #dcd8cc;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #1f4a1f;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}

.settings-input:focus {
  border-color: #2d5a2d;
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.settings-submit {
  background: #2d5a2d;
  color: #f0ede4;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.settings-submit:hover {
  background: #1f4a1f;
}

/* ── FAB ────────────────────────────────────────────────── */

.g-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background-color: #2d5a2d;
  box-shadow: 0 4px 20px rgba(45, 90, 45, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.g-fab:hover {
  background-color: #1f4a1f;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(45, 90, 45, 0.32);
}

.g-fab:active {
  transform: scale(0.96);
}

/* ── Modal ──────────────────────────────────────────────── */

.modal--hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 15, 0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  background: #f7f5ef;
  border-radius: 20px;
  border: 0.5px solid #dcd8cc;
  max-width: 520px;
  width: 100%;
  padding: 36px 40px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #1f4a1f;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 18px;
  color: #a8b8a8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.modal-close-btn:hover {
  background-color: #f0ede4;
  color: #1f4a1f;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.modal-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: #a8b8a8;
  letter-spacing: 0.08em;
}

.modal-input {
  background: #f0ede4;
  border: 0.5px solid #dcd8cc;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #1f4a1f;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.modal-input:focus {
  border-color: #2d5a2d;
}

.modal-input--textarea {
  height: 100px;
  line-height: 1.6;
  resize: none;
  padding-top: 10px;
}

.modal-error {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #c0392b;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.modal-submit {
  background: #2d5a2d;
  color: #f0ede4;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.modal-submit:hover {
  background: #1f4a1f;
}

/* ── Responsive / Mobile ────────────────────────────────── */

@media (max-width: 640px) {
  /* Sidebar becomes overlay on mobile */
  .g-sidebar {
    width: 100%;
    max-width: 280px;
    z-index: 150;
  }

  .g-page.sidebar-open .g-content {
    margin-left: 0;
  }

  /* Dim overlay when sidebar open on mobile */
  .g-page.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 140;
    pointer-events: none;
  }

  /* Full-width modal */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    padding: 28px 24px 40px;
  }

  /* Full-width entry cards */
  .g-main {
    padding: 16px 16px 80px;
  }

  .g-entry-card {
    border-radius: 10px;
    padding: 16px 18px;
  }

  /* Search bar stacks on small screens */
  .g-search-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .g-search-input {
    max-width: 100%;
  }

  /* Settings card full width */
  .settings-card {
    padding: 24px 20px;
  }

  /* Login card tighter */
  .login-card {
    padding: 48px 32px;
  }

  /* Folder grid scales */
  .folder-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 320px;
  }

  .folder-label {
    font-size: 28px;
  }

  /* Header compact */
  .app-header {
    padding: 12px 16px;
  }

  .g-topbar {
    padding: 12px 16px 12px 12px;
  }
}
