@import url(https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap);

/* --- 1. Variables & Theming --- */
:root {
  /* Brand Colors */
  --color-primary: #149546;
  --color-primary-hover: #2563EB;

  /* Backgrounds */
  --bg-body: #F8F7F4;
  /* Main Page Background */
  --bg-surface: rgba(243, 243, 243, 0.9);
  /* Glassmorphism/Cards */
  --bg-header: rgba(255, 255, 255, 0.8);
  --bg-hover: #e9e9e9;

  /* Text */
  --text-main: #202020;
  --text-muted: #6B7280;

  /* Borders & Shadows */
  --border-color: #e1e1e1;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Dark Mode Overrides */
body.dark-mode {
  --color-primary: #25b95f;
  --color-primary-hover: #3B82F6;

  --bg-body: #1A202C;
  --bg-surface: rgba(40, 40, 40, 0.9);
  --bg-header: rgba(26, 32, 44, 0.85);
  --bg-hover: rgba(255, 255, 255, 0.1);

  --text-main: #e0e0e0;
  --text-muted: #A0AEC0;

  --border-color: rgba(255, 255, 255, 0.15);
  --shadow-color: rgba(0, 0, 0, 0.4);
}

/* --- 2. Global Resets --- */
html,
body {
  font-family: "Poppins", sans-serif;
  margin: 0;
  padding: 0;
  transition: background 0.5s, color 0.5s;
  user-select: none;
  -webkit-user-select: none;
  background-color: var(--bg-body);
  color: var(--text-main);
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.notify-dot {
    width: 10px;
    height: 10px;
    background: red;
    position: absolute;
    border-radius: 50%;
    top: -12px;
    right: 8px;
    border: 1px solid white;
}

/* --- Notification Box (The Dropdown) --- */
.notification-box {
    position: absolute;
    top: 6%;
    left: 5%;
    width: 90vw;
    max-width: 90vw;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px) scale(0.8);
    transform-origin: top left;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Animation State: OPEN --- */
.notification-box.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Glass Header */
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.notif-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
}

.mark-read-text {
    background: none;
    border: none;
    color: #149585;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* List Area */
.notif-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch; 
    overscroll-behavior: contain;
    transform: translateZ(0);
}


/* Individual Item */
.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #ededed;
    transition: background 0.1s;
    position: relative;
    cursor: pointer;
}

.notif-item:hover {
    background: #f0f8ff;
}

.notif-item.unread {
    background: rgb(125 255 240 / 13%);
}

/* Icons */
.notif-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon-box i {
    width: 20px;
    height: 20px;
}

/* Icon Colors */
.bg-teal { background: #e0f2f1; color: #149585; }
.bg-blue { background: #e0f2fe; color: #0ea5e9; }
.bg-purple { background: #f3e8ff; color: #a855f7; }

/* Content */
.notif-content p {
    margin: 0 0 4px;
    font-size: 0.8rem;
    color: #334155;
    line-height: 1.4;
}
body.dark-mode .notif-content strong{
    color: white;
}

.notif-time {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Footer */
.notif-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid #f1f5f9;
}

.notif-footer a {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

.notif-footer a:hover {
    color: #149585;
}

/* --- Dark Mode Support --- */
body.dark-mode .notif-btn {
    color: #cbd5e0;
}
body.dark-mode .notif-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
body.dark-mode .notif-badge {
    border-color: #0f172a; /* Match dark header bg */
}

body.dark-mode .notification-box {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.5);
}

body.dark-mode .notif-header {
    border-bottom-color: #334155;
}

body.dark-mode .notif-header h3 {
    color: #f1f5f9;
}

body.dark-mode .notif-item {
    border-bottom-color: #334155;
}

body.dark-mode .notif-item:hover {
    background: #0f172a;
}

body.dark-mode .notif-item.unread {
    background: rgba(20, 149, 133, 0.1);
}

body.dark-mode .notif-content p {
    color: #cbd5e0;
}

body.dark-mode .notif-time {
    color: #94a3b8;
}

body.dark-mode .notif-footer {
    border-top-color: #334155;
}

/* Dark mode icons */
body.dark-mode .bg-teal { background: rgba(20, 149, 133, 0.2); }
body.dark-mode .bg-blue { background: rgba(14, 165, 233, 0.2); }
body.dark-mode .bg-purple { background: rgba(168, 85, 247, 0.2); }


/* Utility: Allow Selection (For Highlighter) */
.allow-selection,
.allow-selection * {
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
}

/* Scrollbar */
*::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

*::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.126);
  border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.8), rgba(168, 85, 247, 0.8));
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

/* --- 3. Header & Navigation --- */
.co-header {
  position: fixed;
  top: 0;
  width: 100vw;
  background-color: var(--bg-header);
  backdrop-filter: blur(10px);
  z-index: 50;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.co-container {
  margin-left: auto;
  margin-right: auto;
  padding: 5px;
}

.co-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo Logic */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-dark {
  display: none;
}

.logo-light {
  display: inline-block;
}

body.dark-mode .logo-light {
  display: none;
}

body.dark-mode .logo-dark {
  display: inline-block;
}

.co-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- 4. Dropdown Menu --- */
.dropdown {
  position: relative;
  display: inline-block;
}

.btn {
  padding: 6px;
  border-radius: 6px;
  background-color: var(--color-primary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.3s;
}

.btn:hover {
  background-color: var(--color-primary-hover);
}

blockquote {
  border-left: 6px solid #2563eb;
  margin: 1.2rem 0;
  font-style: italic;
  color: #4a5568;
  background: #e8f6ff;
  border-radius: .5rem;
  padding: 0 5px;
  text-align: center;
}

body.dark-mode blockquote {
  color: #8fa6cd;
  background: #191919b8;
}

blockquote h1,
blockquote h2,
blockquote h3,
blockquote h4 {
  margin: 0;
}


.dropdown-menu {
  position: absolute;
  top: 120%;
  right: 0;
  min-width: 150px;
  z-index: 9999;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 20px var(--shadow-color);
  backdrop-filter: blur(20px);
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
  transition: all 0.2s ease;
}

.dropdown-menu:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.2s;
}

.dropdown-item:hover {
  background-color: var(--bg-hover);
}

.separator {
  height: 1px;
  background-color: var(--border-color);
  margin: 5px 0;
}

/* --- 5. Loader & Modals --- */
#loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-body);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.8s ease-out;
}

#loader-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loginpagesection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 9998;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.loginpagesection.active {
  display: flex;
  opacity: 1;
}

.leafy-auth-container {
  background: var(--bg-surface);
  padding: 2rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  position: relative;
  text-align: center;
  max-width: 90%;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-main);
}

.leafy-auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: white;
  color: #333;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
}

.leafy-auth-button:hover {
  background-color: #f3f4f6;
}

.leafy-sub-text,
.leafy-terms,
.leafy-explore {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* --- 6. Book Content --- */
#container-wrapper {
  display: flex;
  justify-content: center;
  min-height: 85vh;
  padding-top: 50px;
}

#container {
  width: 100vw;
  height: 80vh;
  border-radius: 5px;
  padding: 10px;
  margin: 2px;
  background: rgba(255, 250, 224, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid var(--border-color);
  overflow-y: auto;
}

#container p {
  font-size: 16px;
  line-height: 30px;
}

figure {
  margin: 0;
}

figure img {
  width: 100%;
  height: auto;
}

body.dark-mode #container {
  background: rgba(74, 74, 74, 0.34);
}

/* --- 7. FAB (Floating Buttons) --- */
#overlaysearch {
  width: 100vw;
  background: #00000099;
  height: 100vh;
  position: absolute;
  z-index: 99;
  backdrop-filter: blur(2px);
  visibility: hidden;
  opacity: 0;
}

.goto-page-box {
  width: 60%;
  position: absolute;
  top: 10%;
  left: 16vw;
  display: flex;
  background: rgb(255 255 255 / 69%);
  backdrop-filter: blur(10px);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(42, 42, 42, 0.2);
  z-index: 100;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

#gotobox {
  visibility: hidden;
}

body.dark-mode .goto-page-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.goto-page-box input {
  width: 60%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgb(46 46 46 / 30%);
  background: rgb(255 255 255);
  color: rgb(21, 21, 21);
  outline: none;
  font-size: 14px;
}

body.dark-mode .goto-page-box input {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
  color: white;
}

.goto-page-box button {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: #149546;
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 2px;
}

.goto-page-box button:hover {
  background: #0f7a38;
}

/* Hide styling for clean number input */
.goto-page-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.fab-container {
  position: fixed;
  bottom: 20px;
  right: 10px;
  z-index: 9000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 15px;
}

.fab-btn {
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.main-btn {
  width: 45px;
  height: 45px;
  background-color: var(--color-primary);
  font-size: 24px;
  z-index: 9002;
}

.mini-btn {
  width: 42px;
  height: 42px;
  background-color: #2c3e50;
  opacity: 0;
  transform: translateY(20px) scale(0);
  pointer-events: none;
}

.fab-container.active .main-btn {
  transform: rotate(135deg);
  background-color: #ef4444;
}

.fab-container.active .mini-btn {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fab-options {
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  align-items: center;
  margin-bottom: 5px;
}

/* Staggered Animation */
.fab-container.active .mini-btn:nth-child(1) {
  transition-delay: 0.01s;
}

.fab-container.active .mini-btn:nth-child(2) {
  transition-delay: 0.02s;
}

.fab-container.active .mini-btn:nth-child(3) {
  transition-delay: 0.03s;
}

.fab-container.active .mini-btn:nth-child(4) {
  transition-delay: 0.04s;
}

.fab-container.active .mini-btn:nth-child(5) {
  transition-delay: 0.05s;
}

.fab-container.active .mini-btn:nth-child(6) {
  transition-delay: 0.06s;
}

.fab-container.active .mini-btn:nth-child(7) {
  transition-delay: 0.07s;
}

.fab-container.active .mini-btn:nth-child(8) {
  transition-delay: 0.08s;
}

.fab-container.active .mini-btn:nth-child(9) {
  transition-delay: 0.09s;
}

.fab-btn:hover {
  transform: scale(1.1);
}

.fab-container.active .main-btn:hover {
  transform: rotate(135deg) scale(1.1);
}

.like-active {
  color: #ffffff !important;
  background: #3b82f6;
}

.save-active {
  color: #ffffff !important;
  background: #f59e0b;
}

/* --- 8. Utilities: Alerts & Toast --- */
.error {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 320px;
  padding: 12px;
  background: #defcdb;
  border: 1px solid #2cc921;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 10001;
  animation: fadeIn 0.5s ease-out;
}

.error__title {
  color: #197123;
  font-size: 0.9rem;
  flex-grow: 1;
}

.error__close {
  cursor: pointer;
}

/* Fixed Toast Centering */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  width: 50vw;
  text-align: center;
  transform: translateX(-50%);
  background-color: rgba(44, 62, 80, 0.95);
  color: white;
  padding: 5px;
  border-radius: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s;
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  bottom: 40px;
}

.shortcuts-panel {
  position: fixed;
  top: 90px;
  right: 80px;
  width: 260px;
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 20px;
  z-index: 9000;
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.shortcuts-panel.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.shortcuts-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.shortcuts-panel li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.shortcuts-panel li:last-child {
  border: none;
}

/* --- 9. Animations --- */
.like {
  position: fixed;
  top: -40px;
  will-change: transform, opacity;
  animation: fall linear forwards;
  pointer-events: none;
  z-index: 11000;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-out {
  animation: fadeOut 0.5s forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Container: Floating Glass Pill */
.pagination-container {
  width: 50%;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  justify-content: space-between;
}

/* Navigation Buttons */
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  /* Large touch target */
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #333;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  /* Remove underline from links */
}

/* Hover & Active States */
.nav-btn:not(.disabled):active {
  background: rgba(0, 0, 0, 0.05);
  transform: scale(0.92);
  /* Shrink slightly on tap */
}

.nav-btn.disabled {
  color: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Text Info */
.page-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
  user-select: none;
}

.current-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #0971ff;
}

.total-pages {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #888;
}

@media screen and (min-width: 900px) {
  .co-header-content {
    padding: 0 20px;
  }

  #container-wrapper {
    min-height: 86vh;
  }

  #container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding-bottom: 40px;
  }
  figure img {
    width: 70%;
    margin-left: 15%;
}

  #resize-shell {
    position: relative;
    width: 90vw;
    height: 92vh;
    min-width: 500px;
    min-height: 400px;
    max-height:98vh ;
  }

  /* 3. Resizer Handles */
  .resizer {
    position: absolute;
    z-index: 999;
  }

  .resizer-l,
  .resizer-r {
    top: 0;
    bottom: 0;
    width: 15px;
    cursor: col-resize;
  }

  .resizer-l {
    left: -7px;
  }

  .resizer-r {
    right: -7px;
  }

  .resizer-b {
    bottom: -7px;
    left: 0;
    right: 0;
    height: 15px;
    cursor: row-resize;
  }

  /* Visual Blue Line */
  .resizer:hover,
  .resizer.resizing {
    background-color: rgba(66, 153, 225, 0.5);
  }

  .pagination-container {
    width: 160px;
    position: fixed;
    bottom: 5px;
    right: 44%;
    background: transparent;
    backdrop-filter: blur(3px);
  }
  .nav-btn{
    color: inherit;
  }

  .current-page {
    font-size: 15px;
  }

  .total-pages {
    font-size: 13px;
  }

  blockquote {
    padding: 10px;
  }
  .toast {
    width: 18vw;
    padding: 15px;
    font-size: 15px;
  }

}

.fab-btn.mini-btn {
  pointer-events: auto;
  /* Force clickable */
  cursor: pointer;
}