/* ── Reset & Base ────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  color: #333;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2d3748;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header h1 i { color: #667eea; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.875rem;
  text-decoration: none;
}

.btn-primary {
  background: #667eea;
  color: white;
}
.btn-primary:hover:not(:disabled) { background: #5a67d8; transform: translateY(-1px); }

.btn-secondary {
  background: #edf2f7;
  color: #4a5568;
}
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.btn-ghost {
  background: transparent;
  color: #718096;
  padding: 0.5rem;
}
.btn-ghost:hover { color: #4a5568; background: #edf2f7; border-radius: 8px; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.btn-icon {
  background: rgba(255,255,255,0.2);
  color: white;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: rgba(255,255,255,0.3); }

/* ── Month / Year Navigation ─────────────────────────────────────────────── */
.month-nav {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.month-nav::-webkit-scrollbar { height: 0; }

.year-nav-btn {
  background: none;
  border: none;
  color: #e53e3e;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.year-nav-btn:hover { background: #fff5f5; }

.today-btn {
  background: #fef08a;
  border: 1.5px solid #eab308;
  color: #713f12;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}
.today-btn:hover { background: #fde047; }

.month-tabs {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.month-tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  color: #718096;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border-radius: 20px;
  white-space: nowrap;
  transition: all 0.15s;
}
.month-tab:hover { background: #edf2f7; color: #2d3748; }
.month-tab.active {
  background: #667eea;
  color: white;
  font-weight: 600;
}

.year-select {
  font-size: 0.85rem;
  font-weight: 700;
  color: #2d3748;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.year-select:focus, .year-select:hover { border-color: #667eea; }

/* ── Main / Calendar Container ───────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  width: 100%;
}

.calendar-container {
  background: white;
  border-radius: 12px;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.5rem;
}

.day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #a0aec0;
  padding: 0.4rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Calendar Grid ───────────────────────────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: default;
  position: relative;
  background: #f7fafc;
  overflow: hidden;
  min-height: 75px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calendar-day.other-month { background: transparent; }

/* Days with photos are clickable */
.calendar-day.has-memories { cursor: pointer; }
.calendar-day.has-memories:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  z-index: 2;
}

/* Today — yellow highlight (matches screenshot) */
.calendar-day.today {
  background: #fef08a;
  box-shadow: inset 0 0 0 2px #eab308;
}
.calendar-day.today .day-number { color: #713f12; }

/* ── Memories carousel ───────────────────────────────────────────────────── */
.carousel-section {
  width: 100%;
  max-width: 900px;
  margin: 1.5rem auto 1.5rem;
  padding: 0 1rem;
}
.carousel-wrap {
  position: relative;
  width: 100%;
  height: 340px;
  border-radius: 16px;
  overflow: hidden;
  background: #1a202c;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
@media (max-width: 600px) {
  .carousel-wrap { height: 220px; }
}
.carousel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-orientation: from-image;
  opacity: 0;
  transition: opacity 1s ease;
}
.carousel-img.active { opacity: 1; }
.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .6rem 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  color: white;
  font-size: .85rem;
  font-family: Inter, sans-serif;
  letter-spacing: .02em;
}

/* ── Map overlay ─────────────────────────────────────────────────────────── */
.map-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #1a202c;
}
#mapContainer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1001;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.map-close:hover { background: rgba(255,255,255,0.2); }
.map-popup img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  cursor: pointer;
}
.map-popup-date {
  font-size: 12px;
  color: #4a5568;
  margin-top: 6px;
  font-family: Inter, sans-serif;
  text-align: center;
}

/* ── Fullscreen slideshow ────────────────────────────────────────────────── */
.slideshow-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slideshow-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-orientation: from-image;
  opacity: 0;
  transition: opacity 1s ease;
}
.slideshow-img.active { opacity: 1; }
.slideshow-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.slideshow-close:hover { background: rgba(255,255,255,0.2); }
.slideshow-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0,0,0,0.4);
  border: none;
  color: #fff;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.slideshow-nav:hover { background: rgba(255,255,255,0.2); }
.slideshow-prev { left: 1rem; }
.slideshow-next { right: 1rem; }
.slideshow-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .75rem 1.25rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 10;
}
.slideshow-caption {
  color: #fff;
  font-size: .95rem;
  font-family: Inter, sans-serif;
  letter-spacing: .02em;
}
.slideshow-counter {
  color: rgba(255,255,255,0.6);
  font-size: .8rem;
  font-family: Inter, sans-serif;
  white-space: nowrap;
  margin-left: 1rem;
}

/* ── Thumbnail inside day cell ───────────────────────────────────────────── */
.date-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  z-index: 1;
  image-orientation: from-image;
}

/* Dark gradient overlay at bottom so text stays readable */
.calendar-day.has-memories::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  border-radius: 0 0 8px 8px;
  z-index: 2;
  pointer-events: none;
}

/* ── Day number & count ──────────────────────────────────────────────────── */
.day-number {
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #4a5568;
  z-index: 3;
  line-height: 1;
}

.calendar-day.has-memories .day-number {
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  background: rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 1px 4px;
}

.memory-count {
  position: absolute;
  bottom: 5px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  z-index: 3;
}

/* ── Media Viewer ────────────────────────────────────────────────────────── */
.media-viewer {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1.25rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  display: none;
}
.media-viewer.active { display: block; }

.media-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.media-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #2d3748;
}

.media-header .btn-icon {
  background: #edf2f7;
  color: #718096;
}
.media-header .btn-icon:hover { background: #e2e8f0; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.media-item {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: #edf2f7;
  position: relative;
}
.media-item:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-orientation: from-image;
}

.video-thumb {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
}

.empty-state {
  text-align: center;
  color: #a0aec0;
  padding: 2.5rem;
  font-size: 0.95rem;
}

/* ── Full-screen Modal ───────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; }

.modal-content {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-close {
  position: absolute;
  top: -48px;
  right: 0;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.3); }

.modal-content img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

/* .modal-info is defined inside .modal-footer section below */

.modal-navigation {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: calc(100% + 80px);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  left: -40px;
}
.modal-navigation .btn { pointer-events: all; width: 42px; height: 42px; }

/* ── User Menu ───────────────────────────────────────────────────────────── */
.user-menu { position: relative; }

.user-menu-btn {
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 0.35rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.user-menu-btn:hover { background: #edf2f7; border-color: #cbd5e0; }
.user-menu-btn i.fa-user-circle { color: #667eea; font-size: 1rem; }

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.show { display: block; }

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: #4a5568;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
}
.dropdown-item:hover { background: #f7fafc; }
.dropdown-item.danger { color: #e53e3e; }
.dropdown-item.danger:hover { background: #fff5f5; }
.dropdown-item i { width: 16px; text-align: center; opacity: 0.7; }

.dropdown-divider { height: 1px; background: #e2e8f0; margin: 0.25rem 0; }

/* ── Hearts ──────────────────────────────────────────────────────────────── */
.heart-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 3;
}
.heart-badge i { color: #fff; }
.heart-badge.hearted i { color: #fc8181; }

.heart-btn {
  background: none;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  color: white;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.heart-btn:hover { border-color: #fc8181; color: #fc8181; }
.heart-btn.hearted { border-color: #fc8181; color: #fc8181; }
.heart-btn.hearted i { animation: heartPop 0.3s ease; }

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ── Modal footer (info + heart side by side) ────────────────────────────── */
.modal-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  color: white;
  margin-top: 0.75rem;
  width: 100%;
}

.modal-info { flex: 1; text-align: left; }
.modal-info h4 { font-size: 0.88rem; margin-bottom: 0.2rem; opacity: 0.85; }
.modal-info p  { font-size: 0.78rem; opacity: 0.6; line-height: 1.5; }

/* ── Comments ────────────────────────────────────────────────────────────── */
.comments-section {
  width: 100%;
  margin-top: 0.75rem;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  max-height: 260px;
  display: flex;
  flex-direction: column;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  max-height: 180px;
}
.comments-list::-webkit-scrollbar { width: 4px; }
.comments-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.comment {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.comment:last-child { border-bottom: none; }

.comment-author {
  font-weight: 700;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.9);
  margin-right: 0.4rem;
}
.comment-text {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  word-break: break-word;
}
.comment-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}
.comment-time { font-size: 0.72rem; color: rgba(255,255,255,0.4); }
.comment-delete {
  background: none; border: none; color: rgba(255,255,255,0.35);
  cursor: pointer; font-size: 0.7rem; padding: 0; line-height: 1;
}
.comment-delete:hover { color: #fc8181; }

.no-comments, .comments-loading {
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
  padding: 0.75rem;
}

.comment-form {
  display: flex;
  align-items: center;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.comment-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 0.875rem;
  font-family: inherit;
  padding: 0.6rem 0.75rem;
}
.comment-form input::placeholder { color: rgba(255,255,255,0.35); }
.comment-form button {
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  transition: color 0.15s;
}
.comment-form button:hover { color: #7f9cf5; }
.comment-form button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Change password modal ───────────────────────────────────────────────── */
.modal-sm {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  max-width: 360px;
  width: 90%;
  color: #2d3748;
}

.field-group { margin-bottom: 1rem; text-align: left; }
.field-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #4a5568; margin-bottom: 0.35rem; }
.field-group input {
  width: 100%; padding: 0.7rem 0.9rem;
  border: 2px solid #e2e8f0; border-radius: 8px;
  font-size: 0.95rem; font-family: inherit; color: #2d3748;
  outline: none; transition: border-color 0.2s;
}
.field-group input:focus { border-color: #667eea; }

.error-msg {
  background: #fed7d7; color: #c53030; border-radius: 8px;
  padding: 0.6rem 0.85rem; margin-bottom: 1rem;
  font-size: 0.85rem; display: none;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-content { padding: 0 1rem; }
  .main { padding: 0.75rem 1rem; }

  .btn-label { display: none; }
  .btn-primary, .btn-secondary { padding: 0.5rem 0.6rem; }

  .month-nav { padding: 0.5rem 1rem; }
  .month-tab { padding: 0.3rem 0.45rem; font-size: 0.78rem; }

  .calendar-day { min-height: 52px; }
  .day-number { font-size: 0.72rem; }
  .memory-count { font-size: 0.58rem; }

  .media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; }

  .modal-navigation { left: -20px; width: calc(100% + 40px); }
}

@media (max-width: 480px) {
  .calendar-day { min-height: 42px; }
  .month-tab { font-size: 0.72rem; padding: 0.25rem 0.35rem; }
}
