/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --primary:        #0d9488;
  --primary-light:  #ccfbf1;
  --primary-dark:   #0f766e;
  --accent:         #f59e0b;
  --accent-light:   #fef3c7;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;
  --bg:             #f0fdf8;
  --bg-card:        #ffffff;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.07);
  --shadow:         0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.12);
  --radius:         14px;
  --radius-sm:      8px;
  --radius-xs:      5px;
  --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }
img { display: block; }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Hero Section ──────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0d9488 0%, #0891b2 50%, #6d28d9 100%);
  color: white;
  padding: 48px 32px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 36px;
}
.hero-photo {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.6);
  overflow: hidden;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-text { text-align: left; }
.hero-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.hero-role {
  font-size: 1rem;
  font-weight: 600;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.hero-desc {
  font-size: .95rem;
  opacity: .9;
  max-width: 480px;
  line-height: 1.6;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: .8rem;
  font-weight: 600;
  margin-top: 12px;
}

/* ── Week Nav ──────────────────────────────────────────────────────────────── */
.week-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.week-nav-label {
  font-size: 1rem;
  font-weight: 700;
  min-width: 260px;
  text-align: center;
  color: var(--text);
}
.week-nav-label small {
  display: block;
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-muted);
}
.btn-nav {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .15s;
}
.btn-nav:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ── App Layout ────────────────────────────────────────────────────────────── */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Admin Layout (calendar + library) ────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* ── Weekly Calendar ───────────────────────────────────────────────────────── */
.calendar-grid {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.calendar-header {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 57px;
  z-index: 50;
  background: var(--bg-card);
}
.calendar-header-cell {
  padding: 12px 8px;
  text-align: center;
  font-weight: 700;
  font-size: .82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.calendar-header-cell.today {
  color: var(--primary);
}
.calendar-header-cell .day-num {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-top: 2px;
}
.calendar-header-cell.today .day-num {
  color: var(--primary);
}

/* ── Time Row ──────────────────────────────────────────────────────────────── */
.time-row {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}
.time-row:last-child { border-bottom: none; }
.time-row.separator { border-top: 2px solid var(--accent-light); }
.time-label {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 4px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  letter-spacing: .3px;
}
.time-label small {
  display: block;
  font-size: .65rem;
  font-weight: 400;
  opacity: .7;
}

/* ── Drop Slots ────────────────────────────────────────────────────────────── */
.drop-slot {
  padding: 6px 5px;
  min-height: 72px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background .15s;
  position: relative;
}
.drop-slot:last-child { border-right: none; }
.drop-slot.drag-over {
  background: var(--primary-light);
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}
.drop-slot.drag-over::after {
  content: '＋ Soltar aquí';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  color: var(--primary);
  pointer-events: none;
  opacity: .6;
}

/* ── Slot Card (scheduled activity) ───────────────────────────────────────── */
.slot-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: grab;
  transition: all .15s;
  font-size: .78rem;
  line-height: 1.3;
  position: relative;
  border-left: 3px solid var(--category-color, var(--primary));
  min-width: 0;
}
.slot-card:active { cursor: grabbing; }
.slot-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.slot-card.dragging { opacity: .4; }
.slot-card-emoji { font-size: 1rem; flex-shrink: 0; }
.slot-card-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.slot-card-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 1;
  border-radius: 3px;
  opacity: 0;
  transition: all .1s;
}
.slot-card:hover .slot-card-remove { opacity: 1; }
.slot-card-remove:hover { color: var(--danger); background: var(--danger-light); }

/* Client slot card (no remove, no drag cursor) */
.client-slot-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  border-left: 4px solid var(--category-color, var(--primary));
  cursor: pointer;
  transition: all .15s;
}
.client-slot-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.client-slot-card-emoji { font-size: 1.2rem; }
.client-slot-card-body { min-width: 0; }
.client-slot-card-time { font-size: .7rem; color: var(--text-muted); font-weight: 600; }
.client-slot-card-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Client Calendar (columnar) ────────────────────────────────────────────── */
.client-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.client-day-col {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.client-day-header {
  padding: 12px;
  text-align: center;
  background: var(--primary);
  color: white;
}
.client-day-header.today { background: var(--accent); }
.client-day-name {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  opacity: .85;
}
.client-day-num {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}
.client-day-body { padding: 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.client-day-empty {
  text-align: center;
  padding: 20px 8px;
  color: var(--text-muted);
  font-size: .8rem;
  font-style: italic;
}

/* ── Library Panel ─────────────────────────────────────────────────────────── */
.library-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
  position: sticky;
  top: 85px;
  overflow: hidden;
}
.library-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.library-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--primary); background: white; }

/* ── Filter Chips ──────────────────────────────────────────────────────────── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}
.chip {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.chip:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ── Library Cards ─────────────────────────────────────────────────────────── */
.library-cards {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lib-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: grab;
  transition: all .15s;
  border-left: 4px solid var(--category-color, var(--primary));
}
.lib-card:active { cursor: grabbing; }
.lib-card:hover {
  box-shadow: var(--shadow);
  background: white;
  transform: translateX(-2px);
}
.lib-card.dragging { opacity: .4; }
.lib-card-emoji { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }
.lib-card-body { min-width: 0; flex: 1; }
.lib-card-title { font-size: .82rem; font-weight: 700; line-height: 1.3; }
.lib-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.badge {
  padding: 2px 7px;
  border-radius: 12px;
  font-size: .65rem;
  font-weight: 700;
  white-space: nowrap;
}
.duration-badge {
  font-size: .65rem;
  color: var(--text-muted);
  font-weight: 600;
}
.lib-card-hidden { display: none; }
.lib-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ── Activity Detail Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: white;
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.modal-emoji { font-size: 2.5rem; line-height: 1; }
.modal-header-text { flex: 1; }
.modal-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 20px 24px 24px; }
.modal-section { margin-bottom: 16px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.modal-section-text {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text);
}
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: .72rem;
  color: var(--text-muted);
}
.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-meta-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.modal-meta-item-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 3px;
}
.modal-meta-item-value { font-size: .85rem; font-weight: 700; color: var(--text); }

/* ── Login Modal ───────────────────────────────────────────────────────────── */
.login-card {
  background: white;
  border-radius: var(--radius);
  max-width: 360px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: slideUp .2s ease;
}
.login-icon { font-size: 2.5rem; margin-bottom: 12px; }
.login-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; }
.login-subtitle { font-size: .85rem; color: var(--text-muted); margin-bottom: 20px; }
.login-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 12px;
}
.login-input:focus { border-color: var(--primary); }
.login-error {
  font-size: .8rem;
  color: var(--danger);
  margin-bottom: 8px;
  min-height: 20px;
}
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 24px;
  font-size: .9rem;
  font-weight: 700;
  width: 100%;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: none;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-size: .85rem;
  font-weight: 600;
  transition: all .15s;
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

/* ── Admin Toolbar ─────────────────────────────────────────────────────────── */
.admin-toolbar {
  background: #1e293b;
  color: white;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .82rem;
}
.admin-toolbar-label {
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-right: 8px;
}
.admin-toolbar .spacer { flex: 1; }
.btn-toolbar {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-xs);
  padding: 6px 14px;
  font-size: .78rem;
  font-weight: 600;
  color: white;
  transition: all .15s;
}
.btn-toolbar:hover { background: rgba(255,255,255,.2); }
.btn-toolbar.danger { border-color: rgba(239,68,68,.5); }
.btn-toolbar.danger:hover { background: rgba(239,68,68,.25); }

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: .8rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.admin-access-btn {
  background: none;
  border: none;
  font-size: .85rem;
  color: transparent;
  cursor: default;
  user-select: none;
  padding: 4px;
  border-radius: 4px;
  transition: all .3s;
}
.admin-access-btn:hover {
  color: var(--text-muted);
  cursor: pointer;
  background: var(--border);
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-week {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-week-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-week-text { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.empty-week-sub { font-size: .85rem; }

/* ── View toggle banner ────────────────────────────────────────────────────── */
.view-banner {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.view-toggle {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 30px;
  padding: 4px;
  display: flex;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}
.view-btn {
  padding: 8px 20px;
  border-radius: 22px;
  border: none;
  background: none;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all .15s;
}
.view-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(13,148,136,.3);
}

/* ── Notification toast ────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: .85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transition: transform .25s ease;
  white-space: nowrap;
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .library-panel { position: static; max-height: 400px; }
  .client-calendar { grid-template-columns: repeat(2, 1fr); }
  .calendar-header, .time-row { grid-template-columns: 50px repeat(7, 1fr); }
  .hero-inner { flex-direction: column; text-align: center; }
  .hero-text { text-align: center; }
}
@media (max-width: 600px) {
  .client-calendar { grid-template-columns: 1fr; }
  .hero-name { font-size: 1.5rem; }
  .week-nav { gap: 10px; padding: 10px 12px; }
  .week-nav-label { font-size: .85rem; min-width: 140px; }
  .btn-nav { padding: 5px 10px; font-size: .75rem; }
}
