/* === CSS Custom Properties (Rainbow Palette) === */
:root {
  --rainbow-red: #FF6B6B;
  --rainbow-orange: #FFA06B;
  --rainbow-yellow: #FFD93D;
  --rainbow-green: #6BCB77;
  --rainbow-blue: #4D96FF;
  --rainbow-indigo: #6B5BFF;
  --rainbow-violet: #C56BFF;
  --font-main: 'Jua', sans-serif;
  --font-handwriting: 'Gaegu', cursive;
}

/* === CSS Reset === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: #FFF9F0;
  color: #333;
  overflow-x: hidden;
  line-height: 1.6;
}

/* === Navigation === */
.rainbow-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 0.8rem 1rem;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.rainbow-nav ul {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  flex-wrap: wrap;
}

.rainbow-nav a {
  text-decoration: none;
  color: var(--rainbow-indigo);
  font-size: 1.1rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.rainbow-nav a:hover {
  background: linear-gradient(135deg, var(--rainbow-red), var(--rainbow-violet));
  color: white;
  transform: scale(1.1);
}

/* === Hero Section === */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(-45deg, 
    var(--rainbow-red), 
    var(--rainbow-orange), 
    var(--rainbow-yellow), 
    var(--rainbow-green), 
    var(--rainbow-blue), 
    var(--rainbow-indigo), 
    var(--rainbow-violet));
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  padding: 2rem;
  padding-top: 5rem;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-content {
  text-align: center;
  z-index: 2;
}

.rainbow-text {
  font-size: 2.8rem;
  color: white;
  text-shadow: 3px 3px 6px rgba(0,0,0,0.2);
  margin-bottom: 1rem;
  animation: bounceIn 1s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.hero-subtitle {
  font-family: var(--font-handwriting);
  font-size: 1.5rem;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  margin-bottom: 2rem;
}

.sparkle-btn {
  font-family: var(--font-main);
  font-size: 1.3rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 50px;
  background: white;
  color: var(--rainbow-violet);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.sparkle-btn:hover {
  transform: scale(1.1) rotate(2deg);
  box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.sparkle-btn:active {
  transform: scale(0.95);
}

/* === Floating Emojis === */
.floating-emojis {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-emoji {
  position: absolute;
  font-size: 2rem;
  animation: floatAround 6s ease-in-out infinite;
}

.float-emoji:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.float-emoji:nth-child(2) { top: 20%; left: 80%; animation-delay: 1s; }
.float-emoji:nth-child(3) { top: 60%; left: 15%; animation-delay: 2s; }
.float-emoji:nth-child(4) { top: 70%; left: 75%; animation-delay: 0.5s; }
.float-emoji:nth-child(5) { top: 40%; left: 90%; animation-delay: 1.5s; }
.float-emoji:nth-child(6) { top: 80%; left: 50%; animation-delay: 2.5s; }
.float-emoji:nth-child(7) { top: 30%; left: 40%; animation-delay: 3s; }

@keyframes floatAround {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-20px) rotate(10deg); }
  50% { transform: translateY(-10px) rotate(-5deg); }
  75% { transform: translateY(-25px) rotate(5deg); }
}

/* === Clouds === */
.clouds {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

.cloud {
  position: absolute;
  font-size: 4rem;
  opacity: 0.6;
  animation: cloudFloat 15s linear infinite;
}

.cloud-1 { top: 10%; animation-delay: 0s; }
.cloud-2 { top: 30%; animation-delay: 5s; }
.cloud-3 { top: 50%; animation-delay: 10s; }

@keyframes cloudFloat {
  0% { transform: translateX(-100px); }
  100% { transform: translateX(calc(100vw + 100px)); }
}

/* === Sections Common === */
.section {
  padding: 4rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.section h2 {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--rainbow-indigo);
}

/* === Fade In Animation === */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === About Section === */
.about-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  border: 3px solid var(--rainbow-yellow);
}

.about-emoji {
  font-size: 5rem;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.about-info p {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-handwriting);
  font-weight: 700;
}

/* === Daily Schedule === */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  border-left: 5px solid;
}

.schedule-item:nth-child(1) { border-color: var(--rainbow-red); }
.schedule-item:nth-child(2) { border-color: var(--rainbow-orange); }
.schedule-item:nth-child(3) { border-color: var(--rainbow-yellow); }
.schedule-item:nth-child(4) { border-color: var(--rainbow-green); }
.schedule-item:nth-child(5) { border-color: var(--rainbow-blue); }
.schedule-item:nth-child(6) { border-color: var(--rainbow-indigo); }
.schedule-item:nth-child(7) { border-color: var(--rainbow-violet); }
.schedule-item:nth-child(8) { border-color: var(--rainbow-red); }
.schedule-item:nth-child(9) { border-color: var(--rainbow-orange); }
.schedule-item:nth-child(10) { border-color: var(--rainbow-yellow); }

.schedule-item:hover {
  transform: translateX(10px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.schedule-time {
  font-size: 1rem;
  white-space: nowrap;
  min-width: 100px;
}

.schedule-activity {
  font-family: var(--font-handwriting);
  font-size: 1.1rem;
  font-weight: 700;
}

/* === Hobby Cards === */
.hobby-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.hobby-card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  border-top: 5px solid var(--card-color);
  transition: all 0.3s ease;
  cursor: default;
}

.hobby-card:hover {
  transform: translateY(-10px) rotate(1deg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.hobby-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: bounce 3s ease infinite;
}

.hobby-card h3 {
  color: var(--card-color);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.hobby-card p {
  font-family: var(--font-handwriting);
  font-size: 1rem;
  font-weight: 700;
  color: #555;
}

/* === Favorites Grid === */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.favorite-item {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}

.favorite-item::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--rainbow-red), var(--rainbow-violet));
  z-index: -1;
}

.favorite-item:hover {
  transform: scale(1.05);
}

.fav-emoji {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.fav-label {
  display: block;
  font-size: 0.9rem;
  color: var(--rainbow-indigo);
  margin-bottom: 0.3rem;
}

.fav-value {
  display: block;
  font-family: var(--font-handwriting);
  font-size: 1.1rem;
  font-weight: 700;
  color: #444;
}

/* === Footer === */
.rainbow-footer {
  background: linear-gradient(135deg, var(--rainbow-indigo), var(--rainbow-violet));
  color: white;
  text-align: center;
  padding: 3rem 2rem;
  margin-top: 3rem;
}

.footer-message {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-sub {
  font-family: var(--font-handwriting);
  font-size: 1.1rem;
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.footer-emojis {
  font-size: 1.8rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.footer-emojis span {
  animation: bounce 2s ease infinite;
}

.footer-emojis span:nth-child(1) { animation-delay: 0s; }
.footer-emojis span:nth-child(2) { animation-delay: 0.2s; }
.footer-emojis span:nth-child(3) { animation-delay: 0.4s; }
.footer-emojis span:nth-child(4) { animation-delay: 0.6s; }
.footer-emojis span:nth-child(5) { animation-delay: 0.8s; }
.footer-emojis span:nth-child(6) { animation-delay: 1s; }
.footer-emojis span:nth-child(7) { animation-delay: 1.2s; }

/* === Emoji Rain === */
.emoji-rain-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.emoji-drop {
  position: absolute;
  top: -50px;
  font-size: 1.5rem;
  animation: emojifall 3s linear forwards;
}

@keyframes emojifall {
  0% { 
    transform: translateY(0) rotate(0deg); 
    opacity: 1; 
  }
  100% { 
    transform: translateY(100vh) rotate(360deg); 
    opacity: 0; 
  }
}

/* === Decorative Elements === */
.section::after {
  content: '';
  display: block;
  width: 60px;
  height: 60px;
  margin: 2rem auto 0;
  background: radial-gradient(circle, var(--rainbow-yellow) 30%, transparent 70%);
  border-radius: 50%;
  opacity: 0.5;
}

/* === Section Actions (Edit/Add Buttons) === */
.section-actions {
  text-align: center;
  margin-bottom: 1.5rem;
}

.action-btn {
  font-family: var(--font-main);
  font-size: 1.1rem;
  padding: 0.6rem 1.5rem;
  border: 2px dashed var(--rainbow-violet);
  border-radius: 25px;
  background: white;
  color: var(--rainbow-violet);
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: var(--rainbow-violet);
  color: white;
  border-style: solid;
  transform: scale(1.05);
}

/* === Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  text-align: center;
  color: var(--rainbow-indigo);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.modal-btn {
  font-family: var(--font-main);
  font-size: 1rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-btn:hover {
  transform: scale(1.05);
}

.modal-btn.save-btn {
  background: var(--rainbow-green);
  color: white;
}

.modal-btn.cancel-btn {
  background: var(--rainbow-red);
  color: white;
}

.modal-btn.add-btn {
  background: var(--rainbow-blue);
  color: white;
}

/* === Schedule Edit Rows === */
.edit-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.edit-row input {
  font-family: var(--font-main);
  font-size: 0.95rem;
  padding: 0.5rem;
  border: 2px solid #eee;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.3s;
}

.edit-row input:focus {
  border-color: var(--rainbow-blue);
}

.edit-emoji {
  width: 50px;
  text-align: center;
}

.edit-time {
  width: 110px;
}

.edit-activity, .edit-desc, .edit-value {
  flex: 1;
  min-width: 150px;
}

.edit-full {
  flex: 1;
  width: 100%;
  min-width: 200px;
}

.edit-name, .edit-label {
  width: 120px;
  min-width: 100px;
}

.delete-row-btn {
  font-size: 1.2rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
  transition: all 0.3s;
}

.delete-row-btn:hover {
  background: var(--rainbow-red);
  transform: scale(1.2);
}

/* === Clickable Card Hint === */
.clickable-card {
  cursor: pointer;
  position: relative;
}

.card-edit-hint {
  display: block;
  font-size: 0.75rem;
  color: #bbb;
  margin-top: 0.5rem;
  transition: color 0.3s;
}

.clickable-card:hover .card-edit-hint {
  color: var(--rainbow-violet);
}

/* === Record Badge on Card === */
.record-badge {
  display: inline-block;
  background: var(--rainbow-green);
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  margin-top: 0.4rem;
}

/* === Records List === */
.records-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 50vh;
  overflow-y: auto;
}

.record-item {
  background: #f9f9f9;
  border-radius: 12px;
  padding: 1rem;
  border-left: 4px solid var(--rainbow-blue);
}

.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.record-header strong {
  font-size: 1.1rem;
  color: #333;
}

.record-date {
  font-size: 0.8rem;
  color: #999;
}

.record-stars {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.record-content {
  font-family: var(--font-handwriting);
  font-size: 1rem;
  font-weight: 700;
  color: #555;
  margin-bottom: 0.5rem;
}

.record-actions {
  display: flex;
  gap: 0.5rem;
}

.record-edit-btn, .record-delete-btn {
  font-family: var(--font-main);
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s;
}

.record-edit-btn {
  background: var(--rainbow-blue);
  color: white;
}

.record-delete-btn {
  background: var(--rainbow-red);
  color: white;
}

.record-edit-btn:hover, .record-delete-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* === Large Modal === */
.modal-large {
  max-width: 700px;
}

/* === Detail Modal textarea === */
.form-group textarea {
  width: 100%;
  font-family: var(--font-main);
  font-size: 1rem;
  padding: 0.7rem 1rem;
  border: 2px solid #eee;
  border-radius: 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.3s;
}

.form-group textarea:focus {
  border-color: var(--rainbow-violet);
}

/* === Book Form === */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 1rem;
  color: var(--rainbow-indigo);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  font-family: var(--font-main);
  font-size: 1rem;
  padding: 0.7rem 1rem;
  border: 2px solid #eee;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.3s;
}

.form-group input:focus {
  border-color: var(--rainbow-violet);
}

.star-rating {
  display: flex;
  gap: 0.3rem;
  font-size: 1.5rem;
}

.star-rating .star {
  cursor: pointer;
  transition: all 0.2s ease;
}

.star-rating .star:hover {
  transform: scale(1.3);
}

/* === Books Grid === */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
}

.book-card {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-left: 5px solid var(--rainbow-orange);
  transition: all 0.3s ease;
  position: relative;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.book-delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.8rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #ccc;
  cursor: pointer;
  transition: color 0.3s;
}

.book-delete-btn:hover {
  color: var(--rainbow-red);
}

.book-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 0.4rem;
}

.book-author {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 0.4rem;
}

.book-stars {
  margin-bottom: 0.4rem;
}

.book-review {
  font-family: var(--font-handwriting);
  font-size: 1rem;
  font-weight: 700;
  color: #555;
  font-style: italic;
  margin-bottom: 0.4rem;
}

.book-date {
  font-size: 0.85rem;
  color: #999;
}

.empty-message {
  text-align: center;
  font-family: var(--font-handwriting);
  font-size: 1.2rem;
  font-weight: 700;
  color: #999;
  padding: 2rem;
}

/* === Responsive Design === */
@media (max-width: 768px) {
  .rainbow-text {
    font-size: 1.8rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  .rainbow-nav ul {
    gap: 0.5rem;
  }
  
  .rainbow-nav a {
    font-size: 0.9rem;
    padding: 0.2rem 0.5rem;
  }
  
  .about-card {
    flex-direction: column;
    text-align: center;
  }
  
  .schedule-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  
  .hobby-cards {
    grid-template-columns: 1fr;
  }
  
  .favorites-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .section h2 {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .favorites-grid {
    grid-template-columns: 1fr;
  }
  
  .rainbow-text {
    font-size: 1.5rem;
  }
  
  .section {
    padding: 2rem 1rem;
  }
}

/* === Reduced Motion Support === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }

  .hero-section {
    animation: none;
    background-size: 100% 100%;
  }
}

/* === Theme Variations (toggled by JS) === */
body.theme-candy {
  --rainbow-red: #FF85A1;
  --rainbow-orange: #FFB347;
  --rainbow-yellow: #FFF176;
  --rainbow-green: #A8E6CF;
  --rainbow-blue: #88D8F7;
  --rainbow-indigo: #B39DDB;
  --rainbow-violet: #F48FB1;
  background: #FFF0F5;
}

body.theme-ocean {
  --rainbow-red: #FF7675;
  --rainbow-orange: #FDCB6E;
  --rainbow-yellow: #FFEAA7;
  --rainbow-green: #00B894;
  --rainbow-blue: #0984E3;
  --rainbow-indigo: #6C5CE7;
  --rainbow-violet: #A29BFE;
  background: #F0F8FF;
}
