/*
 * Calendar Scheduler - Stylesheet
 * Credit: lautandigital.id
 * © 2026 lautandigital.id — All rights reserved
 */

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

:root {
  --primary:        #4f46e5;
  --primary-light:  #818cf8;
  --primary-dark:   #3730a3;
  --accent:         #06b6d4;
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --today-bg:       #ede9fe;
  --today-border:   #4f46e5;
  --event-1:        #4f46e5;
  --event-2:        #0891b2;
  --event-3:        #059669;
  --event-4:        #d97706;
  --event-5:        #dc2626;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 4px 24px rgba(0,0,0,.08);
  --shadow-sm:      0 1px 4px rgba(0,0,0,.06);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(79,70,229,.35);
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

header h1 .icon { font-size: 1.6rem; }

.header-credit {
  font-size: .75rem;
  opacity: .75;
  font-weight: 500;
}

/* ── Layout ── */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 28px 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding: 16px; }
}

/* ── Panel shared ── */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Calendar Panel ── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.calendar-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.nav-btns { display: flex; gap: 6px; }

.btn-icon {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
  color: var(--text);
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-today {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 36px;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .3px;
  transition: background .15s;
}

.btn-today:hover { background: var(--primary-dark); }

/* ── Day-of-week row ── */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.weekdays span {
  text-align: center;
  padding: 10px 4px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

/* ── Days grid ── */
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

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

.day-cell:nth-child(7n) { border-right: none; }

.day-cell:hover { background: #f5f3ff; }

.day-cell.other-month { background: var(--surface-2); }
.day-cell.other-month .day-num { color: #c0c8d8; }

.day-cell.today {
  background: var(--today-bg);
}
.day-cell.today .day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-num {
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Event pills ── */
.event-pill {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  cursor: pointer;
  transition: opacity .12s;
}

.event-pill:hover { opacity: .85; }

.more-events {
  font-size: .65rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* ── Sidebar Panel ── */
.sidebar-panel { display: flex; flex-direction: column; gap: 20px; }

/* ── Add Event Form ── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}

.form-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-dark);
}

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

.form-group label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.form-group textarea { resize: vertical; min-height: 60px; }

.color-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .12s, border-color .12s;
}

.color-dot:hover { transform: scale(1.15); }
.color-dot.active { border-color: #fff; box-shadow: 0 0 0 2px var(--text); }

.btn-add {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .3px;
  transition: background .15s, box-shadow .15s;
  margin-top: 4px;
}

.btn-add:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}

/* ── Upcoming Events ── */
.upcoming-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  flex: 1;
}

.upcoming-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-dark);
}

.upcoming-list { display: flex; flex-direction: column; gap: 10px; }

.upcoming-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background .12s;
}

.upcoming-item:hover { background: #f0eeff; }

.upcoming-color {
  width: 8px;
  min-width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
}

.upcoming-info { flex: 1; min-width: 0; }

.upcoming-title {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upcoming-date {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .85rem;
  color: #ccc;
  transition: color .12s;
  padding: 0 2px;
}

.btn-delete:hover { color: var(--event-5); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
  padding: 20px 0;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
  animation: fadeIn .18s ease;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 90%;
  max-width: 480px;
  overflow: hidden;
  animation: slideUp .2s ease;
}

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

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.btn-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .12s;
}

.btn-close:hover { color: var(--text); }

.modal-body { padding: 18px 22px 8px; }

.modal-event-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.modal-event-item:last-child { border-bottom: none; }

.modal-event-color {
  width: 10px;
  min-width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
}

.modal-event-title { font-size: .9rem; font-weight: 600; }
.modal-event-time  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.modal-event-note  { font-size: .78rem; color: var(--text-muted); margin-top: 2px; font-style: italic; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  font-size: .7rem;
  color: #bbb;
  text-align: right;
}

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

/* ── Footer ── */
footer {
  text-align: center;
  padding: 14px;
  font-size: .72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

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

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