/* ============================================
   DIARY THEME — Sheri The Love
   Dork Diaries / Notebook Aesthetic v2
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=Indie+Flower&family=Patrick+Hand&family=Nunito:wght@400;600;700&display=swap");

/* === CSS VARIABLES === */
:root {
  --purple-light: #CE93D8;
  --purple-dark: #7B1FA2;
  --pink-light: #FCE4EC;
  --pink-mid: #F48FB1;
  --cream: #FFFDF7;
  --cream-dark: #FFF8F0;
  --gold: #FFD54F;
}

/* === NOTEBOOK BACKGROUND === */
.notebook-bg {
  background-color: var(--cream);
  background-image: linear-gradient(rgba(206,147,216,0.15) 1px, transparent 1px);
  background-size: 100% 28px;
  min-height: 100vh;
  position: relative;
}
.notebook-bg::before {
  content: "";
  position: fixed;
  left: 60px;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(244,143,177,0.4);
  pointer-events: none;
  z-index: 0;
}

/* === WASHI TAPE === */
.washi-pink {
  background: repeating-linear-gradient(45deg, #F48FB1 0px, #F48FB1 10px, #FCE4EC 10px, #FCE4EC 20px);
  height: 18px;
  opacity: 0.8;
  transform: rotate(-1deg);
  border-radius: 2px;
}
.washi-purple {
  background: repeating-linear-gradient(45deg, #CE93D8 0px, #CE93D8 10px, #F3E5F5 10px, #F3E5F5 20px);
  height: 18px;
  opacity: 0.8;
  transform: rotate(1deg);
  border-radius: 2px;
}
.washi-yellow {
  background: repeating-linear-gradient(45deg, #FFD54F 0px, #FFD54F 10px, #FFF9C4 10px, #FFF9C4 20px);
  height: 18px;
  opacity: 0.8;
  transform: rotate(-0.5deg);
  border-radius: 2px;
}

/* === STICKERS === */
.sticker-star, .sticker-heart, .sticker-flower {
  position: absolute;
  font-size: 20px;
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}

/* === TORN EDGE === */
.torn-edge::after {
  content: "";
  display: block;
  height: 15px;
  clip-path: polygon(0 0, 2% 100%, 5% 20%, 8% 90%, 11% 10%, 14% 80%, 17% 5%, 20% 95%, 23% 15%, 26% 85%, 29% 0, 32% 90%, 35% 20%, 38% 80%, 41% 5%, 44% 95%, 47% 10%, 50% 100%, 53% 15%, 56% 85%, 59% 0, 62% 90%, 65% 20%, 68% 85%, 71% 10%, 74% 95%, 77% 5%, 80% 80%, 83% 15%, 86% 100%, 89% 20%, 92% 85%, 95% 5%, 98% 90%, 100% 0);
  background: var(--cream);
  margin-top: -1px;
}

/* === CHAT BUBBLES === */
.bubble-buddy {
  background: #F3E5F5;
  border-radius: 18px 18px 18px 4px;
  border: 1.5px dashed #CE93D8;
  padding: 12px 16px;
  max-width: 70%;
  position: relative;
  font-family: "Patrick Hand", cursive;
  font-size: 15px;
  line-height: 1.6;
  color: #4A4A4A;
  word-wrap: break-word;
}
.bubble-user {
  background: #FCE4EC;
  border-radius: 18px 18px 4px 18px;
  padding: 12px 16px;
  max-width: 70%;
  transform: rotate(-0.5deg);
  font-family: "Patrick Hand", cursive;
  font-size: 15px;
  line-height: 1.6;
  color: #4A4A4A;
  word-wrap: break-word;
  border: 1.5px solid #F48FB1;
}

/* === TYPING INDICATOR === */
.typing-indicator {
  padding: 0 20px 8px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.typing-indicator span {
  width: 8px; height: 8px;
  background: #CE93D8;
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-8px)} }

/* === PIN OVERLAY === */
#pin-overlay {
  position: fixed; inset: 0;
  background: rgba(123,31,162,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.pin-box {
  background: var(--cream);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(123,31,162,0.2);
  border: 2px dashed var(--purple-light);
  max-width: 360px;
  width: 90%;
}
.pin-input-row {
  display: flex; gap: 8px; justify-content: center; margin: 20px 0;
  flex-wrap: wrap;
}
.pin-digit {
  width: 36px; height: 48px;
  border: 2px solid var(--purple-light);
  border-radius: 12px;
  background: white;
  font-size: 20px; text-align: center;
  font-family: "Indie Flower", cursive;
  transition: border-color 0.2s;
}
.pin-digit:focus {
  border-color: var(--purple-dark);
  outline: none;
  box-shadow: 0 0 0 3px rgba(206,147,216,0.3);
}
.btn-buka {
  background: linear-gradient(135deg, #CE93D8, #F48FB1);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 32px;
  font-size: 16px;
  font-family: "Indie Flower", cursive;
  cursor: pointer;
  transition: transform 0.1s;
}
.btn-buka:active { transform: scale(0.97); }
.btn-buka:disabled { opacity: 0.5; cursor: not-allowed; }

/* === DIARY HEADER === */
.diary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--cream-dark);
  border-bottom: 2px dashed var(--purple-light);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-brand {
  font-family: "Indie Flower", cursive;
  font-size: 20px;
  color: var(--purple-dark);
  font-weight: bold;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Patrick Hand", cursive;
  color: var(--purple-dark);
  font-size: 15px;
}
.btn-icon {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}
.btn-icon:hover { background: var(--pink-light); }

/* === MOOD SELECTOR === */
.mood-selector {
  text-align: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--pink-light), var(--cream));
  border-bottom: 1px dashed var(--purple-light);
  font-family: "Patrick Hand", cursive;
  font-size: 15px;
  color: #7B1FA2;
}
.mood-options {
  display: flex; gap: 8px; justify-content: center;
  flex-wrap: wrap; margin-top: 8px;
}
.mood-btn {
  background: white;
  border: 2px solid var(--purple-light);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: "Patrick Hand", cursive;
  transition: all 0.2s;
}
.mood-btn:hover {
  background: var(--pink-light);
  border-color: var(--purple-dark);
  transform: scale(1.05);
}

/* === CHAT LAYOUT === */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 280px);
}
.chat-messages { display: flex; flex-direction: column; gap: 12px; }

.message-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.message-user { flex-direction: row-reverse; }
.buddy-avatar { font-size: 24px; flex-shrink: 0; }
.message-user .bubble-user { margin-left: auto; }

/* === SUGGESTED PROMPTS === */
.suggested-prompts-bar {
  overflow-x: auto;
  padding: 8px 16px;
  background: var(--cream-dark);
  border-top: 1px dashed var(--purple-light);
  -webkit-overflow-scrolling: touch;
}
.suggested-prompts { display: flex; gap: 8px; white-space: nowrap; }
.prompt-chip {
  background: white;
  border: 1.5px solid var(--purple-light);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: "Patrick Hand", cursive;
  color: var(--purple-dark);
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.prompt-chip:hover { background: var(--pink-light); transform: scale(1.03); }
.prompt-chip:active { background: var(--purple-light); color: white; }

/* === CHAT INPUT === */
.chat-input-area {
  padding: 12px 16px;
  background: var(--cream-dark);
  border-top: 2px dashed var(--purple-light);
}
.input-wrapper { display: flex; gap: 8px; align-items: flex-end; }
.chat-input {
  flex: 1;
  border: 2px solid var(--purple-light);
  border-radius: 16px;
  padding: 10px 16px;
  font-family: "Patrick Hand", cursive;
  font-size: 15px;
  resize: none;
  background: white;
  outline: none;
  transition: border-color 0.2s;
  max-height: 120px;
  line-height: 1.5;
}
.chat-input:focus { border-color: var(--purple-dark); }
.btn-send {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--purple-light), var(--pink-mid));
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.1s;
  flex-shrink: 0;
}
.btn-send:active { transform: scale(0.93); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* === SIDEBAR === */
.diary-sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--cream-dark);
  border-right: 2px dashed var(--purple-light);
  padding: 16px 8px;
  position: fixed;
  left: 0; top: 0;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  font-family: "Indie Flower", cursive;
  font-size: 16px;
  color: var(--purple-dark);
  padding: 8px 12px 16px;
  border-bottom: 1.5px dashed var(--purple-light);
  margin-bottom: 8px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #555;
  font-family: "Patrick Hand", cursive;
  font-size: 14px;
  transition: all 0.2s;
}
.sidebar-link:hover, .sidebar-link.active {
  background: linear-gradient(135deg, var(--pink-light), var(--cream));
  color: var(--purple-dark);
  font-weight: 600;
}
.sidebar-icon { font-size: 18px; width: 24px; text-align: center; }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--cream);
  border-radius: 20px;
  padding: 28px;
  max-width: 480px;
  width: 90%;
  border: 2px dashed var(--purple-light);
  max-height: 90vh;
  overflow-y: auto;
}
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.preset-card {
  border: 2px solid var(--purple-light);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  background: white;
}
.preset-card:hover { background: var(--pink-light); }
.preset-card.selected { border-color: var(--purple-dark); background: var(--pink-light); }
.preset-icon { font-size: 28px; }
.preset-name {
  font-family: "Patrick Hand", cursive;
  font-weight: 600;
  color: var(--purple-dark);
  margin: 4px 0 2px;
  font-size: 14px;
}
.preset-desc { font-size: 11px; color: #888; font-family: "Nunito", sans-serif; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-family: "Patrick Hand", cursive;
  color: var(--purple-dark);
  margin-bottom: 6px;
  font-size: 15px;
}
.input-cute {
  width: 100%; padding: 8px 14px;
  border: 2px solid var(--purple-light);
  border-radius: 12px;
  font-family: "Patrick Hand", cursive;
  font-size: 15px;
  outline: none;
  background: white;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.input-cute:focus { border-color: var(--purple-dark); }
.btn-cancel {
  background: white;
  border: 2px solid var(--purple-light);
  border-radius: 50px;
  padding: 10px 24px;
  font-family: "Patrick Hand", cursive;
  cursor: pointer;
  color: var(--purple-dark);
  transition: background 0.2s;
}
.btn-cancel:hover { background: var(--pink-light); }

/* === DESKTOP LAYOUT === */
@media (min-width: 768px) {
  /* Sidebar visible on desktop */
  .diary-sidebar {
    display: flex !important;
    position: fixed;
    left: 0;
    top: 0;
    width: 220px;
    height: 100vh;
    z-index: 100;
  }

  /* Main content offset for sidebar */
  .diary-main {
    margin-left: 220px !important;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 220px);
  }

  /* Hide ALL bottom navs on desktop */
  .diary-bottom-nav,
  .bottom-nav,
  nav.bottom-nav {
    display: none !important;
  }

  /* Hide mobile menu toggle */
  .menu-toggle { display: none !important; }

  /* Notebook margin line shift for sidebar */
  body.notebook-bg::before {
    left: 280px;
  }

  /* Chat takes remaining space */
  .chat-container {
    flex: 1;
    overflow-y: auto;
  }

  /* Wider chat bubbles on desktop */
  .bubble-buddy, .bubble-user {
    max-width: 60%;
    font-size: 16px;
  }

  /* Center content area nicely */
  .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 2rem;
  }
}

/* Mobile: sidebar hidden, bottom nav visible */
@media (max-width: 767px) {
  .diary-sidebar {
    display: none !important;
  }
  .diary-main {
    margin-left: 0 !important;
  }
}

/* === MENU TOGGLE (mobile) === */
.menu-toggle {
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--purple-dark);
}
