@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --pink: #ec4899;
  --vip: #f59e0b;
  --vip-bg: #fef9c3;
  --vip-border: #fbbf24;
  --bg: #f5f3ff;
  --white: #ffffff;
  --text: #1e1b4b;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(99,102,241,0.12);
  --shadow-lg: 0 10px 40px rgba(99,102,241,0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  box-shadow: 0 4px 20px rgba(99,102,241,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.6rem;
  font-weight: 900;
  color: white;
  letter-spacing: -0.5px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span { font-size: 1.4rem; }

nav { display: flex; align-items: center; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }

.btn-white {
  background: white;
  color: var(--primary);
}

.btn-ghost {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 2px solid rgba(255,255,255,0.4);
}

.btn-ghost:hover { background: rgba(255,255,255,0.3); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white;
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
}

.btn-sm {
  padding: 5px 14px;
  font-size: 0.8rem;
}

.btn-full { width: 100%; justify-content: center; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: white;
  border: 2px solid rgba(255,255,255,0.5);
}

.vip-crown { font-size: 0.8rem; margin-left: 2px; }

/* ── Main ── */
main { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem 4rem; }

.page-title {
  text-align: center;
  margin-bottom: 1.5rem;
}

.page-title h1 {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-title p { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }

/* ── Calendar ── */
.calendar-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.calendar-nav h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.3px;
}

.nav-btn {
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  color: white;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
}

.nav-btn:hover { background: rgba(255,255,255,0.35); transform: scale(1.1); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.calendar-day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8f7ff;
  border-bottom: 1px solid var(--border);
}

.day-header {
  text-align: center;
  padding: 10px 4px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--border);
}

.day-cell {
  min-height: 110px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  overflow: hidden;
}

.day-cell:hover { background: #f5f3ff; }
.day-cell.empty { cursor: default; background: #fafafa; }
.day-cell.empty:hover { background: #fafafa; }

.day-cell.today {
  background: #eef2ff;
}

.day-cell.today .day-number {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.day-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  display: inline-block;
  margin-bottom: 4px;
  line-height: 1;
}

.day-cell.other-month .day-number { color: #d1d5db; }
.day-cell.other-month { background: #fafafa; }

.event-chip {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  background: #eef2ff;
  color: var(--primary-dark);
  border-left: 3px solid var(--primary);
}

.event-chip.vip {
  background: var(--vip-bg);
  color: #92400e;
  border-left-color: var(--vip);
}

.event-more {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 1px 6px;
}

/* ── Modals ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 75, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

.modal-lg { max-width: 560px; }
.modal-xl { max-width: 680px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.modal-close {
  background: #f3f4f6;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  color: var(--text-muted);
}

.modal-close:hover { background: #e5e7eb; }

.modal-body { padding: 1.25rem 1.5rem; }

/* day action */
.day-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 1.5rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  text-align: left;
  width: 100%;
}

.action-btn:hover { border-color: var(--primary); background: #f5f3ff; transform: translateX(4px); }

.action-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.action-icon.view { background: #eef2ff; }
.action-icon.create { background: #fce7f3; }

.action-label { font-weight: 800; font-size: 1rem; color: var(--text); }
.action-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 12px; }

.timeline-event {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  position: relative;
}

.timeline-event.vip {
  background: var(--vip-bg);
  border-color: var(--vip-border);
  border-left-color: var(--vip);
}

.timeline-time {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-event.vip .timeline-time { color: #92400e; }

.vip-badge {
  background: var(--vip);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 50px;
  letter-spacing: 0.3px;
}

.timeline-topic {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 6px;
  white-space: pre-wrap;
}

.timeline-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-meta span { display: flex; align-items: center; gap: 3px; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state .emoji { font-size: 2.5rem; margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; font-weight: 600; }

/* Form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 5px;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-error {
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fee2e2;
  border-radius: var(--radius-sm);
  display: none;
}

.form-error.show { display: block; }

/* Admin panel */
.user-list { display: flex; flex-direction: column; gap: 10px; }

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fafafa;
}

.user-info { flex: 1; }
.user-name { font-weight: 800; font-size: 0.9rem; }
.user-email { font-size: 0.78rem; color: var(--text-muted); }

.vip-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #ec4899 100%);
  padding: 2rem 1rem;
}

.auth-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
}

.auth-logo {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.auth-footer a:hover { text-decoration: underline; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
  position: relative;
}

/* ── Custom Time Picker ── */
.timepicker-wrap { position: relative; }

.timepicker-dropdown {
  display: none;
  position: fixed;
  z-index: 500;
  background: white;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(99,102,241,0.18);
  overflow: hidden;
  width: 150px;
  flex-direction: column;
}

.timepicker-dropdown.open { display: flex; animation: slideUp 0.15s ease; }

.timepicker-cols { display: flex; }

.timepicker-col-header {
  display: flex;
  background: #f5f3ff;
  border-bottom: 1px solid var(--border);
}

.timepicker-col-header span {
  flex: 1;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary);
  padding: 5px 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.timepicker-col-header span:first-child {
  border-right: 1px solid var(--border);
}

.timepicker-col {
  flex: 1;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.timepicker-col:first-child { border-right: 1px solid var(--border); }

.timepicker-item {
  padding: 7px 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: background 0.1s;
  font-family: 'Nunito', sans-serif;
}

.timepicker-item:hover { background: #eef2ff; color: var(--primary); }

.timepicker-item.selected {
  background: var(--primary);
  color: white;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #c7c7c7; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* Responsive */
@media (max-width: 640px) {
  header { padding: 0 1rem; }
  .logo { font-size: 1.3rem; }
  main { padding: 1rem 0.5rem 3rem; }
  .day-cell { min-height: 70px; }
  .event-chip { font-size: 0.62rem; padding: 1px 4px; }
  .form-row { grid-template-columns: 1fr; }
  .calendar-nav h2 { font-size: 1.1rem; }
}
