:root {
  --primary: #5B67F8;
  --primary-light: #EEF0FF;
  --primary-dark: #4450E5;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --success: #22C55E;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,0.07);
}

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

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

/* LOGIN */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

/* HEADER */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

/* MAIN */
main {
  padding: 20px;
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: 100px;
}

/* FORMS */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input[type="text"],
input[type="password"],
input[type="time"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

/* BUTTONS */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  padding: 10px 18px;
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: #DDE0FF; }

.btn-danger {
  padding: 10px 18px;
  background: var(--danger-light);
  color: var(--danger);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}

.btn-text:hover { background: var(--bg); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s;
}

.btn-icon:hover { background: var(--bg); }
.btn-icon.danger:hover { background: var(--danger-light); color: var(--danger); }

/* FAB */
.fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(91,103,248,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(91,103,248,0.5); }

/* EVENT CARDS */
.events-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.events-empty p { font-size: 15px; margin-top: 8px; }

.event-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow 0.15s;
}

.event-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

.event-card.inactive { opacity: 0.5; }

.event-time {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  min-width: 64px;
  text-align: center;
  flex-shrink: 0;
}

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

.event-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-schedule {
  font-size: 13px;
  color: var(--text-muted);
}

.event-audio-badge {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  margin-top: 2px;
}

.event-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  padding: 0;
}

@media (min-width: 500px) {
  .modal { align-items: center; padding: 20px; }
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 20px;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 500px) {
  .modal-content {
    border-radius: var(--radius);
    max-width: 520px;
    margin: 0 auto;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h2 { font-size: 20px; font-weight: 700; }

.modal-close {
  background: var(--bg);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* RECURRENCE */
.recurrence-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.rec-tab {
  padding: 9px 4px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  color: var(--text-muted);
}

.rec-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* DAYS SELECTOR */
.days-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

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

/* AUDIO SECTION */
.audio-section {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg);
}

.audio-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
}

.audio-controls { display: flex; gap: 8px; flex-wrap: wrap; }

.record-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--primary);
  color: white;
}

.record-btn.recording {
  background: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.audio-preview {
  margin-top: 12px;
}

.audio-preview audio {
  width: 100%;
  margin-bottom: 8px;
}

.audio-preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.record-timer {
  font-size: 14px;
  color: var(--danger);
  font-weight: 600;
  padding: 10px 0;
}

/* MODAL FOOTER */
.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn-primary { flex: 1; }

/* UTILS */
.hidden { display: none !important; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 24px 0 10px;
}

.section-title:first-child { margin-top: 0; }
