/* ==========================================================================
   AGENDA CEO — Design System v2 (Esmeralda & Oro)
   Paridad 100% con frontend_flutter/lib/theme/app_tokens.dart y docs/DESIGN.md
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  /* Marca y Superficies */
  --brand-deep: #0F2F26;
  --brand-primary: #1D4A3C;
  --brand-primary-pressed: #153A2E;
  --brand-header2: #17392F;
  --brand-gold: #C19A5B;

  --surface-sheet: #FBFAF6;
  --surface-page: #F4F2EA;
  --surface-card: #FFFFFF;
  --surface-inset: #F6F4EC;

  /* Texto sobre oscuro */
  --on-dark: #F6F3EA;
  --on-dark-soft: #C9D4CE;
  --on-dark-muted: rgba(246, 243, 234, 0.65);

  /* Texto sobre claro */
  --text-primary: #0F2F26;
  --text-secondary: #4F5D56;
  --text-muted: #5F6B64;
  --text-placeholder: #7A8680;
  --text-gold: #6B4F1F;

  /* Bordes */
  --border-default: #E6E9E5;
  --border-input: #DFE3DF;

  /* Semánticos */
  --success: #1F7A46;
  --success-tint: #E3F1E8;
  --success-border: #BFE0CB;

  --danger-on-dark: #F0A99B;
  --danger-on-light: #B3321F;
  --danger-on-light-bg: #FBE3DF;

  --gold-tint: #F7F2E7;
  --gold-tint-border: #EAD8B5;
  --icon-box-green: #E9F0EA;

  /* Sombras */
  --shadow-sheet: 0 -12px 40px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 8px 20px rgba(15, 47, 38, 0.06);
  --shadow-primary-btn: 0 10px 24px rgba(29, 74, 60, 0.28);
  --shadow-bottom-nav: 0 14px 34px rgba(15, 47, 38, 0.18);
  --shadow-modal: 0 24px 60px rgba(15, 47, 38, 0.28);

  /* Radios */
  --radius-sheet: 32px;
  --radius-card: 22px;
  --radius-nav: 26px;
  --radius-nav-item: 18px;
  --radius-input: 18px;
  --radius-btn: 18px;
  --radius-inset: 16px;
  --radius-icon-btn: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--brand-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* Cabecera Oscura Esmeralda con Brillo Radial Dorado (HeaderShell) */
.ceo-header-gradient {
  background:
    radial-gradient(120% 55% at 88% 0%, rgba(193, 154, 91, 0.28), transparent 64%),
    linear-gradient(165deg, var(--brand-deep) 0%, var(--brand-header2) 60%, var(--brand-deep) 100%);
  color: var(--on-dark);
}

/* Hoja Marfil Principal (Sheet) */
.ceo-ivory-sheet {
  background-color: var(--surface-sheet);
  border-top-left-radius: var(--radius-sheet);
  border-top-right-radius: var(--radius-sheet);
  box-shadow: var(--shadow-sheet);
  min-height: calc(100vh - 155px);
  position: relative;
  z-index: 10;
  animation: sheetSlideUp 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetSlideUp {
  from {
    opacity: 0.92;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ceo-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background-color: var(--border-input);
  margin: 12px auto 6px;
}

/* Tarjeta Ejecutiva (EventCard y Secciones) */
.ceo-card {
  background-color: var(--surface-card);
  border-radius: var(--radius-card);
  border: 1.5px solid var(--border-default);
  box-shadow: var(--shadow-card);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.ceo-card-interactive {
  cursor: pointer;
}

.ceo-card-interactive:hover {
  border-color: rgba(29, 74, 60, 0.32);
  box-shadow: 0 12px 28px rgba(15, 47, 38, 0.10);
  transform: translateY(-1px);
}

.ceo-card-interactive:active {
  transform: translateY(0);
}

/* Contenedor Interno (Surface Inset 4.10) */
.ceo-inset {
  background-color: var(--surface-inset);
  border-radius: var(--radius-inset);
  border: 1px solid var(--border-default);
}

/* Botón de Icono Translúcido sobre Cabecera Oscura (4.2) */
.translucent-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-icon-btn);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: var(--on-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.translucent-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(193, 154, 91, 0.45);
}

.translucent-icon-btn:active {
  transform: scale(0.96);
}

.translucent-icon-btn.danger {
  color: var(--danger-on-dark);
  background: rgba(240, 169, 155, 0.10);
  border-color: rgba(240, 169, 155, 0.22);
}

.translucent-icon-btn.danger:hover {
  background: rgba(240, 169, 155, 0.20);
}

/* Campo de texto con etiqueta integrada (4.4) */
.integrated-input-box {
  min-height: 62px;
  border-radius: var(--radius-input);
  border: 1.5px solid var(--border-input);
  background-color: var(--surface-card);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.integrated-input-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(29, 74, 60, 0.12);
}

.integrated-input-box input,
.integrated-input-box select,
.integrated-input-box textarea {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0;
}

.integrated-input-box input::placeholder,
.integrated-input-box textarea::placeholder {
  color: var(--text-placeholder);
  font-weight: 500;
}

/* Inputs estándar de formulario */
.ceo-input {
  width: 100%;
  border-radius: 14px;
  border: 1.5px solid var(--border-input);
  background-color: var(--surface-card);
  padding: 11px 14px;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ceo-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(29, 74, 60, 0.12);
}

.ceo-input::placeholder {
  color: var(--text-placeholder);
  font-weight: 500;
}

/* Botones (4.5) */
.btn-ceo-primary {
  min-height: 52px;
  border-radius: var(--radius-btn);
  background-color: var(--brand-primary);
  color: var(--on-dark);
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 700;
  border: none;
  box-shadow: var(--shadow-primary-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn-ceo-primary:hover:not(:disabled) {
  background-color: var(--brand-primary-pressed);
}

.btn-ceo-primary:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-ceo-primary:disabled {
  background-color: var(--border-default);
  color: #9AA39D;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ceo-gold {
  min-height: 52px;
  border-radius: var(--radius-btn);
  background-color: var(--gold-tint);
  color: var(--text-primary);
  border: 1.5px solid var(--brand-gold);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.btn-ceo-gold:hover:not(:disabled) {
  background-color: #EFE5CE;
}

.btn-ceo-outline {
  min-height: 48px;
  border-radius: 16px;
  background-color: var(--surface-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border-input);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-ceo-outline:hover:not(:disabled) {
  background-color: var(--surface-inset);
  border-color: var(--brand-primary);
}

.btn-ceo-success {
  min-height: 42px;
  border-radius: 14px;
  background-color: var(--success);
  color: #FFFFFF;
  border: none;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(31, 122, 70, 0.25);
  transition: filter 0.15s ease, transform 0.12s ease;
}

.btn-ceo-success:hover {
  filter: brightness(1.06);
}

/* Badges de Estado (4.6) */
.badge-speech {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  background-color: var(--success-tint);
  border: 1px solid var(--success-border);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.badge-allday {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  background-color: var(--gold-tint);
  border: 1px solid var(--gold-tint-border);
  color: var(--text-gold);
  font-size: 12px;
  font-weight: 700;
}

.badge-neutral {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--surface-inset);
  border: 1px solid var(--border-input);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

/* Etiquetas de privacidad del evento */
.badge-vis {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
}
.badge-vis-PUBLIC { background-color: var(--success-tint); border-color: var(--success-border); color: var(--success); }
.badge-vis-PRIVATE_READER { background-color: rgba(37, 99, 235, 0.10); border-color: rgba(37, 99, 235, 0.30); color: #1E4FBF; }
.badge-vis-PRIVATE { background-color: rgba(122, 62, 157, 0.12); border-color: rgba(122, 62, 157, 0.35); color: #6B2F8C; }
/* DESIGN.md §4.7: sin barra lateral; el evento privado lleva el borde completo */
.card-private { border: 2px solid #7A3E9D !important; }

/* Botón de acción compacto en EventCard (38x38) */
.card-action-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border-input);
  background-color: var(--surface-inset);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-action-icon-btn:hover {
  background-color: var(--icon-box-green);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.card-action-icon-btn.speech {
  background-color: var(--success-tint);
  border-color: var(--success-border);
  color: var(--success);
}

.card-action-icon-btn.speech:hover {
  background-color: #D0E9D9;
}

/* Barra de Navegación Inferior Flotante (4.8 AppBottomNav) */
.ceo-bottom-nav-wrapper {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 560px;
  z-index: 45;
  pointer-events: none;
}

.ceo-bottom-nav {
  pointer-events: auto;
  height: 68px;
  padding: 8px;
  border-radius: var(--radius-nav);
  background-color: var(--surface-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-bottom-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.ceo-nav-item {
  flex: 1;
  height: 52px;
  border-radius: var(--radius-nav-item);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.18s ease;
  padding: 0 4px;
}

.ceo-nav-item:hover:not(.active) {
  background-color: var(--surface-inset);
  color: var(--text-primary);
}

.ceo-nav-item.active {
  background-color: var(--brand-primary);
  color: var(--on-dark);
  font-weight: 800;
}

.ceo-nav-item.active .nav-icon {
  color: var(--brand-gold);
}

/* Calendario Mensual (6.3 MonthCalendarView) */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.month-day-cell {
  aspect-ratio: 1.05;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  border: 1.5px solid transparent;
  background: transparent;
  transition: all 0.15s ease;
}

.month-day-cell:hover:not(.selected):not(.empty) {
  background-color: var(--surface-inset);
}

.month-day-cell.today:not(.selected) {
  border-color: var(--brand-gold);
  background-color: rgba(193, 154, 91, 0.10);
}

.month-day-cell.selected {
  background-color: var(--brand-primary);
  color: var(--on-dark);
  box-shadow: 0 4px 12px rgba(29, 74, 60, 0.25);
}

.month-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--brand-gold);
  margin-top: 3px;
}

/* Tira de Días Semanal en Cabecera Oscura (6.4 WeekAgendaView) */
.week-strip-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-day-pill {
  height: 72px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.week-day-pill:hover:not(.selected) {
  background: rgba(255, 255, 255, 0.12);
}

.week-day-pill.today:not(.selected) {
  border-color: var(--brand-gold);
}

.week-day-pill.selected {
  background-color: var(--surface-sheet);
  color: var(--brand-deep);
  border-color: var(--surface-sheet);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  transform: translateY(-2px);
}

/* Drag & Drop */
.draggable-row {
  cursor: grab;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.draggable-row:active {
  cursor: grabbing;
}

.draggable-row.dragging {
  opacity: 0.55;
  border: 1.5px dashed var(--brand-gold);
  background-color: var(--gold-tint);
}

.drop-zone-active {
  outline: 2px dashed var(--brand-gold);
  background-color: rgba(193, 154, 91, 0.08) !important;
}

/* Modales */
.ceo-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 26, 21, 0.68);
  backdrop-filter: blur(5px);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 160ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ceo-modal-box {
  background-color: var(--surface-card);
  border-radius: 26px;
  border: 1.5px solid var(--border-default);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Teleprónter OLED (#000000 puro) */
#teleprompter-overlay {
  background-color: #000000;
  color: #FFFFFF;
}

#tp-scroll-area::-webkit-scrollbar {
  display: none;
}

#tp-scroll-area {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Scrollbar sutil general */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(29, 74, 60, 0.22);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(29, 74, 60, 0.4);
}

/* Ajustes Leaflet para mini-mapa */
.leaflet-container {
  font-family: 'Manrope', sans-serif !important;
  z-index: 5 !important;
}
