:root {
  --bg-color: transparent; --header-bg: #b2c076; --border-color: #f4b0bd; 
  --empty-cell: rgba(241, 210, 216, 0.7); --past-cell: rgba(220, 220, 220, 0.4); 
  --today-highlight: #ffebd8; --active-highlight: #dff6e8;
  --text-dark: #333333; --frame-bg: url('images/bg_spring.png');
}

[data-theme="summer"] { --header-bg: #8ecae6; --border-color: #ffb703; --empty-cell: rgba(255, 232, 181, 0.7); --past-cell: rgba(200, 210, 220, 0.4); --frame-bg: url('images/bg_summer.png'); }
[data-theme="autumn"] { --header-bg: #e07a5f; --border-color: #d4a373; --empty-cell: rgba(250, 225, 221, 0.7); --past-cell: rgba(210, 190, 190, 0.4); --frame-bg: url('images/bg_autumn.png'); }
[data-theme="winter"] { --header-bg: #98c1d9; --border-color: #a8dadc; --empty-cell: rgba(224, 251, 252, 0.7); --past-cell: rgba(190, 205, 215, 0.4); --frame-bg: url('images/bg_winter.png'); }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Kalam', cursive; color: var(--text-dark); background-color: #fafafa; min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 10px 20px 40px 20px; position: relative; overflow-x: hidden; }

.floral-frame { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: -1; background-image: var(--frame-bg); background-size: cover; background-position: center bottom; opacity: 1; transition: background-image 1s ease-in-out; }

/* HEADER */
.calendar-header { display: flex; justify-content: center; align-items: center; background: rgba(255, 255, 255, 0.85); padding: 15px 30px; border-radius: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 20px; width: 100%; max-width: 1400px; flex-wrap: wrap;}

.header-center { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-grow: 1; justify-content: center;}

.month-display { display: flex; align-items: baseline; gap: 15px; flex-wrap: wrap; justify-content: center; text-align: center; margin-bottom: 3px; }
#month-title { font-family: 'Playfair Display', serif; font-size: 3.5rem; font-weight: 600; letter-spacing: -1px; line-height: 1;}
#year-title { font-family: 'Playfair Display', serif; font-size: 2.2rem; font-weight: 500; color: #555; }

.nav-tools { display: flex; gap: 10px; z-index: 10; flex-wrap: wrap; justify-content: center; }
.tool-btn { background: var(--header-bg); border: none; padding: 6px 18px; border-radius: 20px; cursor: pointer; font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 700; color: rgba(0,0,0,0.7); box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: 0.2s; border: 1px solid rgba(0,0,0,0.1); }
.tool-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }

.edit-toggle-btn { background: #fff; color: #5fac80; border: 2px solid #5fac80; }
.edit-toggle-btn:hover { background: #5fac80; color: #fff; }
.edit-toggle-btn.publishing { background: #ff7675; color: white; border-color: #ff7675; }
.edit-toggle-btn.publishing:hover { background: #d63031; }

.custom-date-search { display: flex; gap: 4px; align-items: center; background: rgba(255,255,255,0.7); padding: 4px 8px; border-radius: 20px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05); }
.search-dropdown { font-family: 'Inter', sans-serif; font-size: 0.85rem; padding: 2px 4px; border: 1px solid rgba(0,0,0,0.1); border-radius: 6px; outline: none; background: white; cursor: pointer; color: #444; font-weight: 600; transition: border 0.2s; }
.search-dropdown:focus { border-color: #5fac80; }
.go-btn { background: #5fac80; color: white; padding: 3px 12px; margin-left: 2px; }
.go-btn:hover { background: #4b8b66; color: white; }

.nav-btn { background: white; border: none; cursor: pointer; color: var(--text-dark); box-shadow: 0 2px 5px rgba(0,0,0,0.1); border-radius: 50%; width: 45px; height: 45px; display: flex; justify-content: center; align-items: center; transition: transform 0.2s; flex-shrink: 0; align-self: center;}
.nav-btn:hover { transform: scale(1.1); }

/* DESKTOP MAIN FRAME */
.calendar-frame { width: 100%; max-width: 1400px; display: flex; flex-direction: row; gap: 30px; background: rgba(255, 255, 255, 0.7); padding: 20px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.1); backdrop-filter: blur(8px); overflow: hidden; }

/* SIDEBAR & NOTEPAD */
.sidebar { width: 320px; display: flex; flex-direction: column; gap: 20px; flex-shrink: 0; }
.notepad { position: relative; background: white; border-radius: 4px; padding: 30px 20px 20px; height: 350px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); display: flex; flex-direction: column; width: 100%; border: 1px solid rgba(0,0,0,0.1); }
.washi-tape { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 100px; height: 25px; background: rgba(178, 192, 118, 0.7); border: 1px dotted rgba(0,0,0,0.1); z-index: 2; }
.torn-edge-top { position: absolute; left: 0; top: -9px; width: 100%; height: 10px; background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M0,5 Q2.5,0 5,5 T10,5 L10,10 L0,10 Z" fill="white"/></svg>'); background-size: 10px 10px; transform: rotate(180deg); }
.torn-edge-bottom { position: absolute; left: 0; bottom: -9px; width: 100%; height: 10px; background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M0,5 Q2.5,0 5,5 T10,5 L10,10 L0,10 Z" fill="white"/></svg>'); background-size: 10px 10px; }

/* TRASH AND NOTEPAD HEADER */
.notepad-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; border-bottom: 1px dashed #ccc; padding-bottom: 5px; min-height: 40px; }
.notepad-title-area { display: flex; flex-direction: column; }
.notepad-bold-day { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.8rem; color: #333; line-height: 1; margin-bottom: 2px;}
.notepad-small-date { font-family: 'Inter', sans-serif; font-size: 0.8rem; color: #888; font-style: italic; }
.trash-btn { background: none; border: none; cursor: pointer; color: #ff7675; opacity: 0; pointer-events: none; transition: 0.2s; display: flex; align-items: center; justify-content: center; margin-top: 5px;}
.trash-btn.show { opacity: 0.7; pointer-events: auto; }
.trash-btn:hover { opacity: 1; transform: scale(1.1); }
body:not(.is-editing) .trash-btn { display: none !important; }

.master-notes { flex-grow: 1; border: none; background: transparent; outline: none; resize: none; font-family: 'Kalam', cursive; font-size: 1.3rem; line-height: 1.6; color: var(--text-dark); cursor: default; }
body.is-editing .master-notes { cursor: text; }

/* SIDEBAR NOTEBOOK NAVIGATION TABS - LESS DRAMATIC */
.notebook-tabs { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.tab-btn { background: rgba(220, 215, 195, 0.4); border: 1px solid rgba(0,0,0,0.05); padding: 12px 18px; font-family: 'Playfair Display', serif; font-size: 1.2rem; font-style: italic; text-align: left; cursor: pointer; border-radius: 0 8px 8px 0; color: #555; transition: background 0.2s, border-right 0.2s; }
.tab-btn:hover { background: rgba(220, 215, 195, 0.7); }
.tab-btn.active { background: white; font-weight: 600; border-right: 4px solid var(--header-bg); color: var(--text-dark); box-shadow: 2px 2px 5px rgba(0,0,0,0.05); }

/* MAIN CALENDAR GRID */
.main-calendar { flex-grow: 1; display: flex; flex-direction: column; border-radius: 8px; width: 100%; min-width: 0; overflow: hidden; }
.main-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.8rem; font-family: 'Inter', sans-serif; font-weight: 700; letter-spacing: 1px; width: 100%; }
.main-weekdays div { background: var(--header-bg); padding: 10px; color: rgba(0,0,0,0.8); border-right: 1px solid white; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; background: rgba(255,255,255,0.7); border-left: 1px solid var(--border-color); border-top: 1px solid var(--border-color); width: 100%; }
.day-cell { height: 140px; background: white; padding: 8px; display: flex; flex-direction: column; position: relative; border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); cursor: text; transition: background 0.2s, box-shadow 0.2s; min-width: 0; }

.day-header-lbl { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 600; color: #444; margin-bottom: 8px; border-bottom: 1px dotted rgba(0,0,0,0.1); padding-bottom: 2px; }
.day-number { font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 600; color: #333; margin-bottom: 2px; }
.day-cell .day-header-lbl { display: none; }

.day-notes-display { flex-grow: 1; font-family: 'Kalam', cursive; font-size: 1.1rem; line-height: 1.3; color: var(--text-dark); background: transparent; white-space: pre-wrap; word-break: break-word; overflow: hidden; border: none; outline: none; resize: none; margin-top: 5px; cursor: default; }
body.is-editing .day-notes-display { cursor: text; }
.day-cell.inactive .day-notes-display { display: none; }

/* WEEKLY MODE OVERRIDES */
.calendar-grid.weekly-mode-grid { 
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; border: none; background: transparent; padding: 10px; 
}

@media (max-width: 1200px) {
    .calendar-grid.weekly-mode-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .calendar-grid.weekly-mode-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .calendar-grid.weekly-mode-grid { grid-template-columns: 1fr; }
}

.calendar-frame.weekly-mode-frame .main-weekdays { display: none; }
.calendar-grid.weekly-mode-grid .day-cell { 
    height: auto; 
    aspect-ratio: 1 / 1.1;
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    padding: 15px; 
}
.calendar-grid.weekly-mode-grid .day-cell .day-header-lbl { display: block; }
.calendar-grid.weekly-mode-grid .day-number { display: none; }

.day-cell.inactive { display: none; }
.calendar-grid:not(.weekly-mode-grid) .day-cell.inactive { display: flex; background: var(--empty-cell); }

.day-cell.past-day { background: var(--past-cell); }
.day-cell.today { background: var(--today-highlight); border: 2px solid #ff9a9e; }
.day-cell.active-selected { background: var(--active-highlight); box-shadow: inset 0 0 0 2px #5fac80; }

.more-btn { position: absolute; bottom: 8px; right: 8px; background: white; border: 1px solid #ccc; border-radius: 12px; padding: 2px 10px; font-weight: bold; cursor: pointer; color: #666; font-size: 0.9rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } 

/* MODAL */
.info-modal { margin: auto; border: none; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); width: 90%; max-width: 450px; background: #fffcf8; padding: 0; }
.info-modal::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: var(--header-bg); border-bottom: 2px solid var(--border-color); }
.modal-title { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: #333; font-weight: 500; }
.modal-close { background: transparent; border: none; cursor: pointer; color: #333; display: flex; opacity: 0.7; } 
.modal-content-area { padding: 20px; font-family: 'Kalam', cursive; font-size: 1.3rem; line-height: 1.6; white-space: pre-wrap; min-height: 150px; max-height: 60vh; overflow-y: auto; color: #333; }

/* MOBILE RESPONSIVE OUTLINE */
@media (max-width: 768px) { 
  .calendar-header { flex-direction: column; padding: 15px; } 
  #month-title { font-size: 2.2rem; }
  #year-title { font-size: 1.5rem; }
  
  .calendar-frame { flex-direction: column; padding: 10px; }
  .sidebar { width: 100%; }
  
  .notebook-tabs { flex-direction: row; flex-wrap: wrap; justify-content: center; width: 100%; gap: 10px;}
  .tab-btn { width: auto; border-radius: 8px; text-align: center; font-size: 1.1rem; padding: 8px 15px; }
  .tab-btn.active { width: auto; border-radius: 8px; border-right: 1px solid rgba(0,0,0,0.05); border-bottom: 3px solid var(--header-bg); }
  
  .main-weekdays { display: none !important; }
  
  .calendar-grid { 
      grid-template-columns: 1fr !important; 
      border: none !important; 
      background: transparent !important; 
      gap: 15px !important; 
      padding: 0 !important;
  }
  
  .day-cell { 
      height: 180px !important; 
      border: 1px solid var(--border-color) !important; 
      border-radius: 12px !important; 
      padding: 15px !important; 
      aspect-ratio: auto !important;
      width: 100% !important;
  }
  .day-cell .day-header-lbl { display: block !important; }
  .day-cell .day-number { display: none !important; }
  .day-cell.inactive { display: none !important; }
}

.cell-scrapbook-btn {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(95,172,128,0.12);
  color: #5fac80;
  border: 1.5px solid rgba(95,172,128,0.35);
  border-radius: 20px;
  padding: 2px 8px 2px 5px;
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  z-index: 5;
  white-space: nowrap;
}
.cell-scrapbook-btn .material-icons-round { font-size: 13px; }
.cell-scrapbook-btn .cell-sb-label { font-size: 0.68rem; }
.cell-scrapbook-btn:hover {
  background: #5fac80;
  color: white;
  box-shadow: 0 2px 8px rgba(95,172,128,0.3);
}

/* LOCK SCREEN */
.lock-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-image: var(--frame-bg);
  background-size: cover;
  background-position: center bottom;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(10px);
}

.lock-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.4);
}

.lock-box {
  position: relative;
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  text-align: center;
  width: 90%;
  max-width: 400px;
  border: 1px solid rgba(0,0,0,0.05);
  animation: floatIn 0.6s ease-out;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.lock-box h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin-bottom: 5px;
  color: #333;
}

.lock-box p {
  color: #666;
  margin-bottom: 25px;
  font-style: italic;
}

.pin-input {
  width: 100%;
  height: 60px;
  font-size: 2rem;
  text-align: center;
  letter-spacing: 15px;
  border-radius: 12px;
  border: 1px solid #ddd;
  margin-bottom: 20px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.pin-input:focus {
  border-color: #5fac80;
}

.unlock-btn {
  width: 100%;
  height: 50px;
  background: #5fac80;
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(95, 172, 128, 0.3);
  transition: transform 0.2s, filter 0.2s;
}

.unlock-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.google-btn {
  background: white !important;
  color: #757575 !important;
  border: 1px solid #ddd !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
}

.google-btn:hover {
  background: #f8f8f8 !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}

.logout-btn {
  background: #f1f1f1 !important;
  color: #888 !important;
  border-radius: 50% !important;
  width: 38px;
  height: 38px;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logout-btn:hover {
  background: #ff7675 !important;
  color: white !important;
}
