/* =============================================================
   AGENDA360 - Design System
   Multi-theme interface with glassmorphism
   ============================================================= */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Shared Layout Tokens ── */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════════
   THEME 1: NOCTURNO (Dark — default)
   ═══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.12);

  --bg-body: #0a0e1a;
  --bg-sidebar: #0f1425;
  --bg-card: #141929;
  --bg-card-hover: #1a2038;
  --bg-input: #1a2038;
  --bg-modal: #181e30;
  --bg-glass: rgba(20, 25, 41, 0.75);

  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--primary-glow);

  --ambient-1: rgba(99, 102, 241, 0.08);
  --ambient-2: rgba(6, 182, 212, 0.06);
  --scrollbar-thumb: rgba(255, 255, 255, 0.1);

  color-scheme: dark;
}

/* ═══════════════════════════════════════════════════════════
   THEME 2: DIURNO (Light)
   ═══════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.18);
  --accent: #0891b2;
  --accent-light: #06b6d4;
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --info: #0891b2;
  --info-bg: rgba(8, 145, 178, 0.08);

  --bg-body: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f1f5f9;
  --bg-modal: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.8);

  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.12);
  --border-focus: rgba(79, 70, 229, 0.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f1f5f9;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px var(--primary-glow);

  --ambient-1: rgba(79, 70, 229, 0.04);
  --ambient-2: rgba(8, 145, 178, 0.03);
  --scrollbar-thumb: rgba(0, 0, 0, 0.15);

  color-scheme: light;
}

/* ═══════════════════════════════════════════════════════════
   THEME 3: OCÉANO (Celeste sobre fondo blanco)
   ═══════════════════════════════════════════════════════════ */
[data-theme="ocean"] {
  --primary: #0284c7;
  --primary-light: #38bdf8;
  --primary-dark: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.2);
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --info: #0284c7;
  --info-bg: rgba(2, 132, 199, 0.1);

  --bg-body: #f0f7ff;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fbff;
  --bg-input: #f0f7ff;
  --bg-modal: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --border: rgba(2, 132, 199, 0.12);
  --border-light: rgba(2, 132, 199, 0.18);
  --border-focus: rgba(2, 132, 199, 0.45);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;

  --shadow-sm: 0 1px 3px rgba(2, 132, 199, 0.06);
  --shadow-md: 0 4px 16px rgba(2, 132, 199, 0.08);
  --shadow-lg: 0 8px 32px rgba(2, 132, 199, 0.12);
  --shadow-glow: 0 0 20px var(--primary-glow);

  --ambient-1: rgba(56, 189, 248, 0.1);
  --ambient-2: rgba(6, 182, 212, 0.06);
  --scrollbar-thumb: rgba(2, 132, 199, 0.2);

  color-scheme: light;
}

/* ═══════════════════════════════════════════════════════════
   THEME 4: ESMERALDA (Green dark)
   ═══════════════════════════════════════════════════════════ */
[data-theme="emerald"] {
  --primary: #10b981;
  --primary-light: #34d399;
  --primary-dark: #059669;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #eab308;
  --warning-bg: rgba(234, 179, 8, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.12);

  --bg-body: #0a1a14;
  --bg-sidebar: #0d1f18;
  --bg-card: #11261d;
  --bg-card-hover: #163326;
  --bg-input: #163326;
  --bg-modal: #132a20;
  --bg-glass: rgba(13, 31, 24, 0.8);

  --border: rgba(16, 185, 129, 0.08);
  --border-light: rgba(16, 185, 129, 0.14);
  --border-focus: rgba(16, 185, 129, 0.5);

  --text-primary: #ecfdf5;
  --text-secondary: #a7f3d0;
  --text-muted: #6ee7b7;
  --text-inverse: #0a1a14;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px var(--primary-glow);

  --ambient-1: rgba(16, 185, 129, 0.08);
  --ambient-2: rgba(6, 182, 212, 0.05);
  --scrollbar-thumb: rgba(16, 185, 129, 0.15);

  color-scheme: dark;
}

/* ═══════════════════════════════════════════════════════════
   THEME 5: ROSADO (Tonos rosas sobre fondo blanco)
   ═══════════════════════════════════════════════════════════ */
[data-theme="rose"] {
  --primary: #db2777;
  --primary-light: #f472b6;
  --primary-dark: #be185d;
  --primary-glow: rgba(219, 39, 119, 0.2);
  --accent: #9333ea;
  --accent-light: #c084fc;
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger: #e11d48;
  --danger-bg: rgba(225, 29, 72, 0.08);
  --info: #db2777;
  --info-bg: rgba(219, 39, 119, 0.1);

  --bg-body: #fff5f8;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fff1f5;
  --bg-input: #fff1f5;
  --bg-modal: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --border: rgba(219, 39, 119, 0.12);
  --border-light: rgba(219, 39, 119, 0.18);
  --border-focus: rgba(219, 39, 119, 0.45);

  --text-primary: #1e1018;
  --text-secondary: #4c2338;
  --text-muted: #834768;
  --text-inverse: #fff1f5;

  --shadow-sm: 0 1px 3px rgba(219, 39, 119, 0.06);
  --shadow-md: 0 4px 16px rgba(219, 39, 119, 0.08);
  --shadow-lg: 0 8px 32px rgba(219, 39, 119, 0.12);
  --shadow-glow: 0 0 20px var(--primary-glow);

  --ambient-1: rgba(244, 114, 182, 0.1);
  --ambient-2: rgba(192, 132, 252, 0.06);
  --scrollbar-thumb: rgba(219, 39, 119, 0.2);

  color-scheme: light;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle ambient gradient on body — uses theme variables */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 10% 20%, var(--ambient-1, transparent), transparent),
    radial-gradient(ellipse 500px 400px at 85% 70%, var(--ambient-2, transparent), transparent);
  pointer-events: none;
  z-index: 0;
  transition: background 0.5s ease;
}

a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  color: var(--accent-light);
}

img {
  max-width: 100%;
  display: block;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb, rgba(255, 255, 255, 0.1));
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  opacity: 0.8;
}

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  transition: margin-left var(--transition-base);
  overflow-x: hidden;
}

.page-container {
  padding: 24px;
  max-width: 1600px;
  overflow-x: hidden;
}

/* ── Header ── */
.app-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transition: left var(--transition-base);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.btn-menu-toggle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ── Sidebar ── */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1200;
  transition: transform var(--transition-base), width var(--transition-base);
  overflow: hidden;
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.btn-sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-sidebar-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-brand-text span {
  color: var(--primary-light);
}

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

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: 2px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.08));
  color: var(--primary-light);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 2px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 4px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
}

.btn-success:hover {
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

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

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
}

.btn-whatsapp:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-fast);
}

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

/* ── Form Controls ── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Stats Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-color, var(--primary));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-light);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.8rem;
  opacity: 0.15;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Badge / Tag ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-status {
  background: var(--badge-bg);
  color: var(--badge-color);
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 300px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--toast-color, var(--primary));
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast-message {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.toast-icon {
  font-size: 1.1rem;
}

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ── Table ── */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(99, 102, 241, 0.04);
  color: var(--text-primary);
}

/* ── Date Navigation ── */
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-nav-current {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 180px;
  text-align: center;
}

.date-nav-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-bar .form-control {
  max-width: 200px;
}

/* ── Profesional Chip ── */
.prof-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 2px solid transparent;
  background: var(--bg-card);
}

.prof-chip:hover,
.prof-chip.active {
  border-color: var(--chip-color, var(--primary));
  background: rgba(255, 255, 255, 0.05);
}

.prof-chip .chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip-color, var(--primary));
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state-text {
  font-size: 0.95rem;
  font-weight: 500;
}

/* ── Tab Bar ── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab-item {
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  background: none;
  font-family: inherit;
}

.tab-item:hover {
  color: var(--text-secondary);
}

.tab-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ── Responsive System: Consolidated at the end of stylesheet ── */

/* ── Utilities ── */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-4 {
  gap: 4px;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.fw-600 {
  font-weight: 600;
}

.fw-700 {
  font-weight: 700;
}

.fs-sm {
  font-size: 0.78rem;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* ── Pulse animation for live status ── */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ── Loading spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ═══════════════════════════════════════════════════════════
   Theme Switcher Component
   ═══════════════════════════════════════════════════════════ */
.theme-switcher {
  position: relative;
}

.theme-trigger {
  font-size: 1.15rem;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px;
  min-width: 190px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-base);
  z-index: 500;
}

.theme-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-dropdown-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 6px 10px 8px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.theme-option:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.theme-option.active {
  background: var(--primary-glow);
  color: var(--primary-light);
  font-weight: 600;
}

.theme-option .bx {
  font-size: 1rem;
  margin-left: auto;
  opacity: 0.5;
}

.theme-option.active .bx {
  opacity: 1;
  color: var(--primary);
}

.theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
}

.theme-option.active .theme-swatch {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* ── Smooth theme transitions on key elements ── */
body,
.app-sidebar,
.app-header,
.card,
.modal,
.stat-card,
.agenda-multi,
.agenda-col-header,
.form-control,
select.form-control {
  transition:
    background-color 0.4s ease,
    border-color 0.4s ease,
    color 0.3s ease;
}

/* ── Voice Dictation Button & Pulse Waves ── */
.btn-voice-ai {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s ease;
  box-shadow: 0 0 14px var(--primary-glow);
  position: relative;
}

.btn-voice-ai:hover {
  transform: scale(1.05);
}

.btn-voice-ai.listening {
  background: linear-gradient(135deg, #ef4444, #f43f5e) !important;
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.6) !important;
  animation: voiceWavePulse 1.3s infinite ease-in-out;
}

.btn-voice-ai.listening::after {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 2px solid #ef4444;
  animation: voiceRipple 1.3s infinite cubic-bezier(0, 0.2, 0.8, 1);
}

@keyframes voiceWavePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes voiceRipple {
  0% {
    transform: scale(0.9);
    opacity: 1;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* ── Custom Select with Boxicons ── */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  transition: var(--transition-fast);
  text-align: left;
}

.custom-select-trigger:hover,
.custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.custom-select-current {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.custom-select-current i,
.custom-select-option i {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.custom-select-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.custom-select-wrapper.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  display: none !important;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.custom-select-wrapper.open>.custom-select-dropdown {
  display: block !important;
  animation: fadeIn 0.15s ease;
}

.custom-select-option {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.custom-select-option:hover {
  background: var(--bg-input);
  color: var(--primary-light);
}

.custom-select-option.active {
  background: var(--primary-glow);
  color: var(--primary-light);
  font-weight: 600;
}

/* =============================================================
   UX/UI REVIEWER - RESPONSIVE SYSTEM (TABLET & MOBILE)
   ============================================================= */

/* ── Sidebar Backdrop Overlay ── */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Tablet & Small Laptops (<= 1024px) ── */
@media screen and (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 1200;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.5);
  }

  .app-sidebar.open {
    transform: translateX(0) !important;
  }

  .btn-sidebar-close {
    display: flex;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .app-header {
    left: 0 !important;
    padding: 0 18px;
  }

  .btn-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
  }

  .btn-menu-toggle:active {
    transform: scale(0.95);
  }
}

/* ── Tablet Portrait & Phablets (<= 768px) ── */
@media screen and (max-width: 768px) {
  .page-container {
    padding: 16px 12px;
  }

  .page-title {
    font-size: 1.1rem;
  }

  /* Prevent iOS Safari auto-zoom on inputs */
  .form-control,
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="file"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Stack form rows vertically */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .form-row .form-group {
    width: 100% !important;
  }

  /* Responsive Modals for Touch — native-app feel */
  .modal-overlay {
    align-items: flex-start;
    padding: 8px 6px;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
    padding: 0;
    max-height: 94vh;
    overflow-y: auto;
    border-radius: var(--radius-md);
    box-sizing: border-box;
  }

  .modal-header {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: var(--bg-modal);
    z-index: 2;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .modal-title {
    font-size: 1.05rem;
  }

  .modal-body {
    padding: 16px 14px;
  }

  .modal-footer {
    padding: 12px 14px;
    position: sticky;
    bottom: 0;
    background: var(--bg-modal);
    z-index: 2;
  }

  /* Native horizontal scrolling with smooth touch inertia */
  .table-responsive,
  .table-container,
  .overflow-x-auto {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-radius: var(--radius-sm);
  }

  .table-responsive::-webkit-scrollbar,
  .table-container::-webkit-scrollbar,
  .overflow-x-auto::-webkit-scrollbar {
    display: none;
  }

  /* Button touch sizes */
  .btn {
    min-height: 38px;
    padding: 8px 14px;
  }

  .btn:active {
    transform: scale(0.97);
  }

  /* Stats grid on tablet */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Filter bar on tablet & mobile */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-bar .form-control {
    max-width: 100% !important;
  }

  .filter-bar button[type="submit"] {
    width: 100%;
    justify-content: center;
  }

  /* Responsive Grids on Tablet & Mobile */
  #planSelectorGrid,
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 240px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}

/* ── Mobile Phones (<= 480px) ── */
@media screen and (max-width: 480px) {
  .page-container {
    padding: 12px 8px;
  }

  .app-header {
    padding: 0 10px;
    height: 56px;
  }

  .main-content {
    padding-top: 56px;
  }

  .page-title {
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
  }

  .header-right {
    gap: 6px;
  }


  /* Card paddings */
  .card {
    border-radius: var(--radius-sm);
  }

  .card-body {
    padding: 14px 12px;
  }

  .card-header {
    padding: 12px 14px;
  }

  /* Stats grid on small phones */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .stat-card {
    padding: 12px 10px !important;
  }

  .stat-value {
    font-size: 1.2rem !important;
  }

  .stat-label {
    font-size: 0.72rem !important;
  }

  /* Grid layouts on small phones: prevent overflow from inline minmax() */
  #profsGrid,
  .config-grid,
  div[style*="minmax(360px"],
  div[style*="minmax(380px"] {
    grid-template-columns: 1fr !important;
  }

  /* Modal: full-width bottom-sheet on small phones */
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 96vh !important;
    border-radius: 16px 16px 0 0 !important;
    box-sizing: border-box !important;
  }

  .modal-body {
    padding: 14px 12px !important;
  }

  .modal-header {
    padding: 12px 14px !important;
    position: sticky;
    top: 0;
    background: var(--bg-modal);
    z-index: 2;
    border-radius: 16px 16px 0 0;
  }

  .modal-footer {
    padding: 10px 14px !important;
    position: sticky;
    bottom: 0;
    background: var(--bg-modal);
    z-index: 2;
  }

  .modal-title {
    font-size: 1rem !important;
  }
}

/* ── Bloqueos de Horario y Ausencias (Agenda) ── */
.slot-is-blocked {
  background: rgba(239, 68, 68, 0.04) !important;
  cursor: not-allowed !important;
}

.slot-blocked {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.74rem;
  color: #ef4444;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  cursor: not-allowed !important;
  transition: background var(--transition-fast);
}

.slot-blocked:hover {
  background: rgba(239, 68, 68, 0.12);
}