/* =============================================
   AGENDA COM LEMBRETES - Estilos Principais
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --primary:        #4f46e5;
  --primary-light:  #6366f1;
  --primary-dark:   #3730a3;
  --secondary:      #06b6d4;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --surface-3:      #f1f5f9;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --text-1:         #0f172a;
  --text-2:         #334155;
  --text-3:         #64748b;
  --text-muted:     #94a3b8;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:      0 10px 24px -4px rgba(0,0,0,.10), 0 4px 8px -4px rgba(0,0,0,.06);
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --sidebar-w:      260px;
  --header-h:       64px;
  --transition:     .2s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- LAYOUT ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
}
.sidebar-logo h1 { font-size: 16px; font-weight: 700; color: var(--text-1); }
.sidebar-logo span { font-size: 11px; color: var(--text-muted); display: block; }

.sidebar-nav { flex: 1; padding: 12px 12px; overflow-y: auto; }

.nav-section-title {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-3);
  font-size: 14px; font-weight: 500;
  transition: all var(--transition);
  user-select: none;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--text-1); }
.nav-item.active {
  background: #eef2ff;
  color: var(--primary);
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 20px;
  min-width: 20px; text-align: center;
}
.nav-item .nav-badge.red { background: var(--danger); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-date {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  padding: 16px;
  color: white;
  text-align: center;
}
.sidebar-date .day   { font-size: 40px; font-weight: 700; line-height: 1; }
.sidebar-date .month { font-size: 13px; font-weight: 500; opacity: .85; margin-top: 2px; }
.sidebar-date .year  { font-size: 12px; opacity: .65; }

/* ---- MAIN ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  width: 260px;
  transition: all var(--transition);
}
.search-box:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.search-box i { color: var(--text-muted); font-size: 14px; }
.search-box input {
  border: none; background: none; outline: none;
  font-size: 14px; color: var(--text-1); width: 100%;
  font-family: inherit;
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 16px;
  position: relative;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text-1); }
.btn-icon .badge {
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--danger); color: #fff;
  border-radius: 50%; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

/* ---- PAGES ---- */
.page { display: none; padding: 24px; }
.page.active { display: block; }

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.card-body { padding: 16px 20px 20px; }

/* ---- STAT CARDS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: #eef2ff; color: var(--primary); }
.stat-icon.cyan   { background: #ecfeff; color: var(--secondary); }
.stat-icon.green  { background: #ecfdf5; color: var(--success); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-label  { font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-value  { font-size: 26px; font-weight: 700; color: var(--text-1); line-height: 1.2; }
.stat-sub    { font-size: 11px; color: var(--text-muted); }

/* ---- DASHBOARD GRID ---- */
.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

/* ---- EVENTS LIST ---- */
.event-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }
.event-color-bar {
  width: 4px; border-radius: 4px; align-self: stretch; flex-shrink: 0;
  min-height: 40px;
}
.event-info { flex: 1; }
.event-title    { font-size: 14px; font-weight: 600; color: var(--text-1); }
.event-meta     { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.event-time     { font-size: 12px; color: var(--text-muted); text-align: right; white-space: nowrap; }

/* ---- PRIORITY BADGE ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-alta   { background: #fef2f2; color: var(--danger); }
.badge-media  { background: #fffbeb; color: #d97706; }
.badge-baixa  { background: #f0fdf4; color: var(--success); }
.badge-pendente   { background: #f8fafc; color: var(--text-3); }
.badge-concluido  { background: #ecfdf5; color: var(--success); }
.badge-cancelado  { background: #fef2f2; color: var(--danger); }

/* ---- CALENDAR ---- */
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-title { font-size: 17px; font-weight: 700; }
.calendar-nav {
  display: flex; gap: 4px;
}
.calendar-nav button {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: all var(--transition);
}
.calendar-nav button:hover { background: var(--surface-3); color: var(--text-1); }

.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-weekday {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-muted); padding: 6px 0; text-transform: uppercase;
}
.calendar-day {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2);
  position: relative; transition: all var(--transition); padding: 4px;
  border: 1px solid transparent;
}
.calendar-day:hover { background: var(--surface-3); }
.calendar-day.today {
  background: var(--primary); color: white; font-weight: 700;
}
.calendar-day.has-events::after {
  content: ''; position: absolute; bottom: 4px;
  display: flex; gap: 2px;
}
.calendar-day .event-dots {
  display: flex; gap: 2px; position: absolute; bottom: 4px;
}
.event-dot {
  width: 5px; height: 5px; border-radius: 50%;
}
.calendar-day.other-month { color: var(--text-muted); opacity: .4; }
.calendar-day.selected {
  border-color: var(--primary); background: #eef2ff;
}
.calendar-day.today.selected { background: var(--primary-dark); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(16px) scale(.98);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding-bottom: 16px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 16px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-3); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ---- FORM ---- */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-1);
  font-family: inherit; background: var(--surface);
  outline: none;
  transition: all var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: flex; gap: 12px; margin-bottom: 14px;
}
.form-row .form-group { flex: 1; margin-bottom: 0; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; font-family: inherit;
  transition: all var(--transition);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger   { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success  { background: var(--success); color: white; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 9px; font-size: 12px; }

/* ---- LEMBRETE ITEMS ---- */
.lembrete-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.lembrete-row select { flex: 1; }

/* ---- TOAST NOTIFICATIONS ---- */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--text-1);
  color: white;
  padding: 13px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px;
  animation: toastIn .3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.info    { border-left: 4px solid var(--secondary); }
.toast.warning { border-left: 4px solid var(--warning); }
@keyframes toastIn { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }

/* ---- REMINDER POPUP ---- */
#reminder-popup {
  position: fixed; top: 24px; right: 24px;
  z-index: 9998;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 320px;
}
.reminder-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  border-left: 4px solid var(--primary);
  animation: slideIn .3s ease;
}
@keyframes slideIn {
  from { opacity:0; transform: translateX(60px); }
  to   { opacity:1; transform: translateX(0); }
}
.reminder-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.reminder-info  { font-size: 12px; color: var(--text-3); }
.reminder-close-btn {
  font-size: 11px; font-weight: 600; color: var(--primary);
  background: none; border: none; cursor: pointer;
  margin-top: 8px; padding: 0;
}

/* ---- TASK LIST ---- */
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }

.task-check {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.task-check.done { background: var(--success); border-color: var(--success); color: white; font-size: 11px; }
.task-label { flex: 1; font-size: 14px; cursor: pointer; }
.task-label.done { text-decoration: line-through; color: var(--text-muted); }

/* ---- EVENTOS PAGE TOOLBAR ---- */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-3);
  transition: all var(--transition);
}
.filter-chip:hover, .filter-chip.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ---- EVENTS TABLE ---- */
.events-table { width: 100%; border-collapse: collapse; }
.events-table th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.events-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.events-table tr:last-child td { border-bottom: none; }
.events-table tr:hover td { background: var(--surface-2); }

.event-row-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ---- ACTION MENU ---- */
.action-btns { display: flex; gap: 6px; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* ---- MOBILE ---- */
.hamburger {
  display: none; width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
  align-items: center; justify-content: center; font-size: 18px;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .search-box { display: none; }
}

/* ---- EMPTY STATE ---- */
.empty-state {
  padding: 48px 20px; text-align: center; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; }
.empty-state p { font-size: 14px; }

/* ---- TOGGLE ---- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 99;
}
.sidebar-overlay.open { display: block; }
