/* =========================================================
   NOTES SYSTEM — NOTES PAGE STYLESHEET
   Used by notes.html

   Shared styles are also included in notes-admin.css.
========================================================= */

/* =========================================================
   1. THEME VARIABLES
========================================================= */

:root {
  --bg: #070b14;

  --card: rgba(18, 25, 40, 0.82);
  --card-hover: rgba(25, 34, 54, 0.95);

  --text: #f5f7ff;
  --muted: #9ca8bd;
  --border: rgba(255, 255, 255, 0.1);

  --accent: #4cc9ff;
  --accent2: #8b5cf6;
  --danger: #ff4d6d;

  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);

  --aurora-mint: #5eead4;
  --aurora-glow: rgba(76, 201, 255, 0.14);

  --surface-blur: 18px;
  --motion-smooth: 240ms ease;
}

body.light-mode {
  --bg: #f4f7fb;

  --card: rgba(255, 255, 255, 0.9);
  --card-hover: #ffffff;

  --text: #101522;
  --muted: #64748b;
  --border: rgba(0, 0, 0, 0.1);

  --shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

/* =========================================================
   2. GLOBAL STYLES AND BACKGROUND
========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  isolation: isolate;

  display: flex;
  flex-direction: column;

  min-height: 100vh;

  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background:
    radial-gradient(
      circle at 20% 10%,
      rgba(124, 92, 255, 0.18),
      transparent 30%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(0, 212, 255, 0.12),
      transparent 30%
    ),
    var(--bg);

  color: var(--text);

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  transition:
    background 0.3s,
    color 0.3s;
}

/* Decorative ambient lighting behind page content. */
body::before,
body::after {
  content: "";

  position: fixed;
  z-index: -1;

  width: min(45vw, 580px);
  aspect-ratio: 1;

  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.09;

  pointer-events: none;

  animation: notesAuroraFloat 20s ease-in-out infinite alternate;
}

body::before {
  top: -20%;
  left: -15%;
  background: var(--accent);
}

body::after {
  right: -18%;
  bottom: -20%;

  background: var(--accent2);

  animation-delay: -10s;
}

body.light-mode::before,
body.light-mode::after {
  opacity: 0.07;
}

/* =========================================================
   3. SHARED HEADER
========================================================= */

.notes-header {
  position: sticky;
  top: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  padding: 16px 5%;

  background: rgba(7, 11, 20, 0.76);

  border-bottom: 1px solid rgba(76, 201, 255, 0.18);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.12);

  backdrop-filter: blur(var(--surface-blur));
  -webkit-backdrop-filter: blur(var(--surface-blur));

  transition:
    background var(--motion-smooth),
    border-color var(--motion-smooth);
}

body.light-mode .notes-header {
  background: rgba(244, 247, 251, 0.82);
  border-bottom-color: rgba(76, 125, 180, 0.18);
}

.header-title {
  text-align: center;
}

.header-title h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
}

.header-title p {
  margin: 3px 0 0;

  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.back-button,
.portfolio-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 14px;

  border: 1px solid var(--border);
  border-radius: 12px;

  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;

  text-decoration: none;
  cursor: pointer;

  transition:
    transform var(--motion-smooth),
    color var(--motion-smooth),
    background var(--motion-smooth),
    border-color var(--motion-smooth),
    box-shadow var(--motion-smooth);
}

.back-button {
  background: transparent;
  color: var(--text);
}

.portfolio-button {
  background: linear-gradient(45deg, #4cc9ff, #7b61ff);
  color: #fff;
  border-color: transparent;
}

.back-button:hover,
.portfolio-button:hover {
  transform: translateY(-2px);
}

.back-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.portfolio-button:hover {
  box-shadow: 0 8px 20px rgba(76, 201, 255, 0.2);
}

.header-navigation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

#clock {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;

  border: 1px solid var(--border);
  border-radius: 50%;

  background: var(--card);
  color: var(--text);

  cursor: pointer;

  transition:
    transform var(--motion-smooth),
    background var(--motion-smooth),
    border-color var(--motion-smooth),
    box-shadow var(--motion-smooth);
}

.icon-button:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--aurora-glow);
}

/* =========================================================
   4. PAGE CONTAINERS AND BREADCRUMBS
========================================================= */

.notes-container,
.admin-container {
  width: min(1120px, 92%);
  margin: 40px auto;
}

.notes-container {
  flex: 1 0 auto;
}

.admin-container {
  min-width: 0;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;

  margin-bottom: 25px;

  color: var(--muted);
  line-height: 1.8;
}

.breadcrumb {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;

  transition: color var(--motion-smooth);
}

.breadcrumb:hover {
  color: var(--aurora-mint);
}

.breadcrumb:not(:last-child)::after {
  content: " / ";
  color: var(--muted);
}

/* =========================================================
   5. SEARCH
========================================================= */

.search-box {
  position: relative;
  margin-bottom: 28px;
}

.search-box input {
  width: 100%;
  min-height: 52px;

  padding: 15px 18px;

  border: 1px solid var(--border);
  border-radius: 16px;

  outline: none;

  background: var(--card);
  color: var(--text);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  transition:
    border-color var(--motion-smooth),
    box-shadow var(--motion-smooth),
    background var(--motion-smooth);
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(76, 201, 255, 0.1);
}

/* =========================================================
   6. NOTES AND FOLDER GRIDS
========================================================= */

.notes-content,
.admin-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.admin-content {
  min-width: 0;
}

.admin-content:empty {
  min-height: 30px;
}

.folder-card,
.note-card {
  position: relative;
  overflow: hidden;

  padding: 20px;

  border: 1px solid var(--border);
  border-radius: 18px;

  background: var(--card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);

  animation: cardIn 0.45s ease both;

  transition:
    transform 260ms ease,
    background 260ms ease,
    border-color 260ms ease,
    box-shadow 260ms ease;
}

/* Accent line revealed when a card is hovered. */
.folder-card::before,
.note-card::before {
  content: "";

  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;

  height: 1px;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(76, 201, 255, 0.65),
    rgba(139, 92, 246, 0.65),
    transparent
  );

  opacity: 0;
  transition: opacity var(--motion-smooth);
}

.folder-card:hover,
.note-card:hover {
  transform: translateY(-5px);

  background: var(--card-hover);
  border-color: rgba(76, 201, 255, 0.4);

  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.folder-card:hover::before,
.note-card:hover::before {
  opacity: 1;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.folder-icon,
.note-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 52px;
  height: 52px;

  margin-bottom: 14px;

  border-radius: 15px;

  font-size: 2.4rem;

  transition:
    transform var(--motion-smooth),
    filter var(--motion-smooth);
}

.folder-icon {
  color: var(--accent);
}

.note-icon {
  color: #ff7070;
}

.folder-card:hover .folder-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 12px rgba(76, 201, 255, 0.22));
  transform: translateY(-4px) scale(1.08);
}

.note-card:hover .note-icon {
  filter: drop-shadow(0 0 12px rgba(255, 112, 112, 0.2));
  transform: translateY(-4px) scale(1.08);
}

.folder-card h3,
.note-card h3 {
  margin: 5px 0 8px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.note-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* =========================================================
   7. BUTTONS
========================================================= */

.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  padding: 12px 18px;

  border: none;
  border-radius: 12px;

  cursor: pointer;
  font: inherit;
  font-weight: 700;

  transition:
    transform var(--motion-smooth),
    opacity var(--motion-smooth),
    box-shadow var(--motion-smooth),
    border-color var(--motion-smooth),
    background var(--motion-smooth);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #07111f;
  box-shadow: 0 7px 20px rgba(76, 201, 255, 0.12);
}

.secondary-button {
  background: rgba(124, 92, 255, 0.15);
  color: var(--text);
  border: 1px solid rgba(124, 92, 255, 0.3);
}

.danger-button {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 77, 109, 0.25);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-2px);
}

.primary-button:hover {
  box-shadow: 0 10px 26px rgba(76, 201, 255, 0.22);
}

/* =========================================================
   8. SHARED ADMIN COMPONENTS
========================================================= */

.admin-card {
  min-width: 0;

  margin-bottom: 25px;
  padding: 25px;

  border: 1px solid var(--border);
  border-radius: 20px;

  background: var(--card);
  box-shadow: var(--shadow);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-card h2 {
  margin-top: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.login-card {
  width: min(450px, 100%);
  margin: 80px auto;
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

form label {
  margin-top: 8px;
  color: var(--muted);
}

form input,
form textarea {
  width: 100%;
  padding: 13px;

  border: 1px solid var(--border);
  border-radius: 12px;

  outline: none;

  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.admin-topbar,
.folder-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;

  margin-bottom: 20px;
}

.status {
  min-height: 25px;
  margin-bottom: 15px;
  font-weight: 600;
}

.admin-note-card {
  padding: 18px;

  border: 1px solid var(--border);
  border-radius: 16px;

  background: rgba(255, 255, 255, 0.03);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  margin-top: 15px;
}

.admin-actions button {
  min-height: 40px;
  padding: 9px 12px;

  border: none;
  border-radius: 10px;

  cursor: pointer;

  transition:
    transform var(--motion-smooth),
    background var(--motion-smooth),
    box-shadow var(--motion-smooth);
}

.admin-actions button:hover {
  transform: translateY(-2px);
}

.view-note-button {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent);
}

.view-note-button:hover {
  background: rgba(0, 212, 255, 0.2);
}

.delete-note-button {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
}

.delete-note-button:hover {
  background: rgba(255, 77, 109, 0.2);
}

.folder-admin-card {
  position: relative;
}

/* =========================================================
   9. PDF VIEWER MODAL
========================================================= */

.pdf-modal {
  display: none;

  position: fixed;
  inset: 0;
  z-index: 100;

  padding: 15px;

  background: rgba(2, 6, 18, 0.88);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pdf-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-window {
  display: flex;
  flex-direction: column;

  width: min(1200px, 100%);
  height: 95vh;

  overflow: hidden;

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;

  background: #111827;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.pdf-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;

  height: 55px;
  padding: 0 15px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.1);

  background: rgba(17, 24, 39, 0.98);
  color: white;
}

#pdfFrame {
  flex: 1;
  width: 100%;
  border: none;
}

.close-button {
  width: 38px;
  height: 38px;

  border: none;
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.1);
  color: white;

  cursor: pointer;

  transition:
    transform var(--motion-smooth),
    background var(--motion-smooth);
}

.close-button:hover {
  transform: rotate(90deg);
  background: rgba(255, 77, 109, 0.22);
}

/* =========================================================
   10. SHARED ACCESSIBILITY AND ANIMATIONS
========================================================= */

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@keyframes notesAuroraFloat {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(28px, -22px, 0) scale(1.1);
  }
}

/* =========================================================
   11. SHARED FOOTER
========================================================= */

.site-footer {
  position: relative;
  isolation: isolate;

  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;

  width: 100%;
  margin-top: auto;
  padding: 28px 20px;

  border-top: 1px solid var(--border);

  background: rgba(7, 11, 20, 0.28);
  color: var(--muted);

  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.7;
  text-align: center;
}

body.light-mode .site-footer {
  background: rgba(255, 255, 255, 0.35);
}

.site-footer p {
  display: block;

  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;

  color: var(--muted);
  font: inherit;
  font-weight: 400;
  line-height: inherit;
  text-align: center;

  overflow-wrap: anywhere;
}

.site-footer .footer-name {
  display: inline;
  color: var(--text);
  font-weight: 700;
}

.site-footer .footer-heart,
.site-footer .footer-separator {
  display: inline;
  color: var(--accent);
}

.site-footer .footer-separator {
  margin: 0 5px;
}

.site-footer .footer-home {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;

  width: fit-content;
  max-width: 100%;

  margin: 0;
  padding: 9px 15px;

  border: 1px solid var(--border);
  border-radius: 12px;

  background: var(--card);
  color: var(--accent);

  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;

  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;

  transition:
    color var(--motion-smooth),
    background var(--motion-smooth),
    border-color var(--motion-smooth),
    box-shadow var(--motion-smooth),
    transform var(--motion-smooth);
}

.site-footer .footer-home i {
  flex-shrink: 0;
}

.site-footer .footer-home:hover {
  transform: translateY(-2px);

  color: var(--text);
  background: var(--card-hover);
  border-color: var(--accent);

  box-shadow: 0 6px 20px var(--aurora-glow);
}

/* =========================================================
   12. RESPONSIVE LAYOUTS — NOTES PAGE
========================================================= */

@media (max-width: 650px) {
  .notes-header {
    padding: 12px 4%;
  }

  .header-title h1 {
    font-size: 1rem;
  }

  .header-title p,
  .notes-header #clock {
    display: none;
  }

  .notes-container,
  .admin-container {
    width: 92%;
    margin-top: 25px;
  }

  .notes-content,
  .admin-content {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .folder-card,
  .note-card {
    padding: 18px;
  }

  .admin-topbar,
  .folder-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .pdf-window {
    height: 100vh;
    border-radius: 0;
  }

  .header-navigation {
    gap: 7px;
  }

  .back-button,
  .portfolio-button {
    padding: 9px 11px;
    font-size: 0.82rem;
  }

  body::before,
  body::after {
    width: 75vw;
    filter: blur(75px);
  }

  .site-footer {
    margin-top: 40px;
    padding: 24px 14px;
    gap: 10px;
    font-size: 0.84rem;
  }

  .site-footer p {
    max-width: 420px;
  }

  .site-footer .footer-home {
    padding: 9px 13px;
    font-size: 0.84rem;
  }
}

/* =========================================================
   13. REDUCED MOTION
   Respect the visitor's operating-system accessibility setting.
========================================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  body::before,
  body::after {
    animation: none;
  }

  .folder-card,
  .note-card {
    animation: none;
  }

  .site-footer .footer-home:hover {
    transform: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
