:root {
  --leather: #5c2a16;
  --paper: #fdf6e3;
  --ring-color: linear-gradient(to bottom, #f0f0f0, #999, #555, #f0f0f0);
}

body {
  background-color: #1a252f;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  font-family: 'Georgia', serif;
  overflow: hidden;
  min-width: 900px;
}

.binder {
  position: relative;
  display: flex;
  padding: 2vh 1.5vw;
  border-radius: 15px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.7), inset 0 0 30px rgba(0,0,0,0.5);
  perspective: 2000px;

  background-color: #4a200f;
  background-image:
  radial-gradient(circle at 50% 50%, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.2) 100%),
  repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0,0,0,0.1) 6px, rgba(0,0,0,0.1) 10px);
  border: 4px solid #3d1a0b;
}

.binder::before {
  content: '';
  position: absolute;
  top: 10px; left: 10px; right: 10px; bottom: 10px;
  border: 2px dashed rgba(255,255,255,0.1);
  pointer-events: none;
  border-radius: 10px;
}

.binder::after {
  content: "Yeay Organizer 1.0";
  position: absolute;
  top: 99.45%;
  left: 55%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Georgia', serif;
  font-size: 0.5rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  pointer-events: none;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.page {
  width: 38vw;
  height: 80vh;
  background: var(--paper);
  padding: 40px;
  box-sizing: border-box;
  position: relative;
  overflow-y: auto;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.page.left { border-radius: 10px 0 0 10px; border-right: 1px solid #dcd1b3; }
.page.right { border-radius: 0 10px 10px 0; border-left: 1px solid #dcd1b3; z-index: 1; }

.rings {
  position: absolute;
  left: 50%;
  top: 5vh;
  bottom: 5vh;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  z-index: 100;
  width: 16px;
  pointer-events: none;
}

.ring {
  width: 100%;
  height: 10px;
  background: var(--ring-color);
  border-radius: 5px;
  box-shadow: 2px 3px 5px rgba(0,0,0,0.5);
}

.tabs { position: absolute; display: flex; flex-direction: column; gap: 4px; z-index: 10; }
.tabs-left { left: -40px; top: 50px; }
.tabs-right { right: -40px; top: 150px; }

.tab {
  width: 40px;
  padding: 10px 0;
  text-align: center;
  color: white;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  font-family: sans-serif;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
  transition: 0.2s;
}

.tab-l { border-radius: 8px 0 0 8px; }
.tab-r { border-radius: 0 8px 8px 0; }
.tab:hover { width: 45px; }

#tabs-az {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  max-height: 85vh;
  padding-right: 5px;
}

#tabs-az::-webkit-scrollbar { width: 4px; }
#tabs-az::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); }

.corner-nav {
  position: absolute;
  bottom: 0;
  width: 60px;
  height: 60px;
  background-color: #dcd1b3;
  cursor: pointer;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 10px;
  color: #5c2a16;
}

.corner-prev { left: 0; clip-path: polygon(0 0, 100% 100%, 0 100%); border-radius: 0 0 0 10px; }

.corner-prev-left {
  position: absolute;
  bottom: 0; left: 0;
  width: 60px; height: 60px;
  background: #dcd1b3;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  border-radius: 0 0 0 10px;
  cursor: pointer;
  display: flex; justify-content: center; align-items: center; color: #5c2a16; font-weight: bold;
}
.corner-prev-left.disabled { opacity: 0.2; cursor: default; }

.corner-next { right: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); border-radius: 0 0 10px 0; }

.corner-nav:hover { background-color: #c9bc9a; }
.corner-nav.disabled { background-color: #eee; cursor: default; opacity: 0.5; }

.flipper {
  position: absolute;
  left: 1.5vw;
  top: 2vh;
  width: 38vw;
  height: 80vh;
  background: var(--paper);
  transform-origin: right center;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  border-radius: 10px 0 0 10px;
  border-right: 1px solid #dcd1b3;
}

@keyframes flipPageLeftToRight {
  0% { transform: rotateY(0deg); opacity: 1; }
  100% { transform: rotateY(180deg); opacity: 0; }
}

@keyframes flipPageRightToLeft {
  0%   { transform: rotateY(0deg);    opacity: 1; }
  100% { transform: rotateY(-180deg); opacity: 0; }
}

.animate-flip { animation: flipPageLeftToRight 0.6s ease-in-out forwards; }

.animate-reverse-flip {
  left: auto;
  right: 1.5vw;
  transform-origin: left center;
  animation: flipPageRightToLeft 0.6s ease-in-out forwards;
}

h2 { border-bottom: 2px solid #5c2a16; padding-bottom: 10px; color: #5c2a16; }
textarea { width: 100%; height: 80%; background: transparent; border: none; font-family: 'Georgia'; font-size: 18px; line-height: 1.6; resize: none; outline: none; background-image: linear-gradient(#dcd1b3 1px, transparent 1px); background-size: 100% 1.6em; }

.todo-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eee; }
.todo-item span { flex-grow: 1; }
.delete-btn { background: #c0392b; color: white; border: none; padding: 2px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.delete-btn:hover { background: #e74c3c; }

input[type="text"] { flex: 1; padding: 8px; border: 1px solid #ddd; font-family: 'Georgia'; }
.add-btn { cursor: pointer; background: #5c2a16; color: white; border: none; padding: 8px 15px; }

.add-contact-icon {
  display: inline-block;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  background: #5c2a16;
  border: 2px outset #8b4513;
  padding: 2px 10px;
  margin-top: 10px;
  user-select: none;
  font-family: sans-serif;
  line-height: 1;
  text-align: center;
}

.add-contact-icon:active {
  border-style: inset;
  background: #4a200f;
}

.edit-note-btn {
  cursor: pointer;
  font-size: 1.2em;
  filter: grayscale(1);
  transition: transform 0.2s, color 0.2s;
}

.edit-note-btn.has-note {
  filter: none;
  color: #5c2a16;
}

.edit-note-btn:hover { transform: scale(1.3); }

#note-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.post-it {
  background: #fffa88;
  width: 300px;
  height: 300px;
  padding: 20px;
  box-shadow: 10px 10px 15px rgba(0,0,0,0.3);
  transform: rotate(-2deg);
  display: flex;
  flex-direction: column;
  font-family: 'Permanent Marker', cursive, sans-serif;
}

.post-it textarea {
  flex: 1;
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  font-size: 18px;
  color: #333;
  background-image: none;
}

.post-it-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  width: 100%;
}

.post-it-save {
  background: #27ae60;
  color: white;
  border: none;
  padding: 5px 15px;
  cursor: pointer;
}

.post-it-cancel {
  background: #c0392b;
  color: white;
  border: none;
  padding: 5px 15px;
  cursor: pointer;
}

#contact-modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 3000; justify-content: center; align-items: center;
}
.contact-form-container {
  background: #fdf6e3; padding: 20px; border-radius: 8px; width: 300px;
  display: flex; flex-direction: column; gap: 10px;
}
.contact-form-container input { padding: 8px; font-family: 'Georgia'; }

/* ── Calendar ────────────────────────────────────────────────────────────────── */

.cal-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  padding-bottom: 70px; /* space for corner nav */
}

.cal-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid #e8dfc8;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 30px;
  background: #fffef8;
}

.cal-slot:hover { background: #f5ede0; border-color: #c9b08a; }
.cal-slot.has-entry { background: #fef5e0; border-color: #d4b069; }
.cal-slot.has-entry:hover { background: #fdeecb; }

.cal-hour {
  font-size: 11px;
  font-weight: bold;
  color: #5c2a16;
  min-width: 34px;
  font-family: 'Courier New', monospace;
}

.cal-hour-end {
  font-size: 10px;
  color: #bba882;
  min-width: 34px;
  font-family: 'Courier New', monospace;
}

.cal-text {
  flex: 1;
  font-size: 12px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-placeholder { color: #ccc; }

.cal-bell {
  font-size: 13px;
  filter: grayscale(1);
  opacity: 0.3;
  transition: all 0.2s;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cal-bell:hover { opacity: 0.7; background: rgba(0,0,0,0.05); }
.cal-bell.active { filter: none; opacity: 1; }

/* ── Calendar entry modal ────────────────────────────────────────────────────── */

#cal-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.65);
  z-index: 3000;
  justify-content: center;
  align-items: center;
}

.cal-modal-box {
  background: #fdf6e3;
  padding: 24px;
  border-radius: 8px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  border: 2px solid #5c2a16;
}

.cal-modal-box h3 {
  margin: 0;
  color: #5c2a16;
  font-size: 15px;
  border-bottom: 1px solid #dcd1b3;
  padding-bottom: 10px;
}

.cal-modal-box textarea {
  background: #fffef5;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px;
  font-family: 'Georgia';
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  background-image: none;
  width: 100%;
  box-sizing: border-box;
  color: #333;
}

.cal-modal-box textarea:focus { outline: none; border-color: #5c2a16; }

.cal-reminder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #444;
  background: #f5ede0;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #e0d0b8;
}

.cal-reminder-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.cal-reminder-row label { cursor: pointer; }

.cal-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.cal-modal-actions button {
  padding: 8px 18px;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  font-family: 'Georgia';
  font-size: 13px;
  transition: opacity 0.15s;
}

.cal-modal-actions button:hover { opacity: 0.85; }
.cal-btn-save   { background: #5c2a16; color: white; }
.cal-btn-cancel { background: #bbb; color: #333; }

/* ── Reminder flash animation ─────────────────────────────────────────────── */

@keyframes reminderFlash {
  0%   { box-shadow: 0 20px 50px rgba(0,0,0,0.7), inset 0 0 30px rgba(0,0,0,0.5); }
  40%  { box-shadow: 0 20px 60px rgba(255,200,50,0.9), inset 0 0 40px rgba(255,200,50,0.25); }
  100% { box-shadow: 0 20px 50px rgba(0,0,0,0.7), inset 0 0 30px rgba(0,0,0,0.5); }
}

.reminder-flash { animation: reminderFlash 0.5s ease 3; }
