/* ===== DESIGN TOKENS - OpenFinc ===== */
:root {
  --header-bg: #0A3D62;        /* Navy confiable */
  --primary: #1E90FF;          /* Acción principal */
  --primary-600: #0A66C2;      /* Hover */
  --primary-light: #6BB3F0;    /* Azul suave tipo logo (selector idiomas, acentos) */
  --accent: #F5A623;           /* CTA alterno */
  --card: #FFFFFF;
  --body: #FFFFFF;
  --muted: #F5F8FB;
  --border: #E6EEF5;
  --text: #0C1A24;
  --text-2: #44596A;
  --danger: #C62828;
  --success: #1B5E20;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(10,61,98,.08);
  /** Ancho máximo para inputs de cantidad y fecha (toda la plataforma) */
  --input-amount-date-max-width: 15ch;
}

/* ===== INPUTS CANTIDAD Y FECHA - Ancho máximo (constante de plataforma) ===== */
input.form-control[type="number"],
input.form-control[type="date"],
input.form-control[type="datetime-local"],
input.form-control[type="time"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="datetime-local"],
.form-field input[type="time"] {
  max-width: var(--input-amount-date-max-width);
}

/* ===== RESET Y BASE ===== */
html, body {
  margin: 0;
  padding: 0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--body);
  color: var(--text);
  line-height: 1.5;
  font-size: 1rem;
}

/* ===== TIPOGRAFÍA ===== */
h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

.hint {
  font-size: .85rem;
  color: var(--text-2);
  margin: 0;
}

/* ===== BOTONES ===== */
.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .06s;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-600);
}

.btn.secondary {
  background: #EEF3F7;
  color: var(--header-bg);
}

.btn.secondary:hover {
  background: #E5EDF5;
}

.btn.outline {
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
}

.btn.outline:hover {
  background: rgba(30,144,255,.08);
}

/* ===== INPUTS Y SELECTS ===== */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-weight: 600;
  color: var(--text);
  font-size: .95rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #F9FBFD;
  color: var(--text);
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #9DC6FF;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(30,144,255,.15);
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.form-field input::placeholder {
  color: #94A3B8;
}

.field-error {
  font-size: .85rem;
  color: var(--danger);
  margin: 0;
  display: none;
}

.field-error:not(:empty) {
  display: block;
}

.form-field input.error,
.form-field select.error,
.form-field textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(198,40,40,.15);
}

/* Estilos para mensajes de error de Yii2 */
.help-block {
  color: #DC3545 !important;
  font-size: 0.8rem;
  margin-top: 4px;
  display: block;
}

.has-error .help-block {
  color: #DC3545 !important;
}

.has-error .form-control {
  border-color: #DC3545 !important;
}

/* Mensajes de error generales */
.error-message {
  color: #DC3545 !important;
  font-size: 0.8rem;
  margin-top: 4px;
  font-weight: 500;
}

/* ===== SELECT CON CARET ===== */
.select {
  position: relative;
}

.select select {
  appearance: none;
  padding-right: 38px;
}

.select:after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%) rotate(45deg);
  border-right: 2px solid #6B7A89;
  border-bottom: 2px solid #6B7A89;
  pointer-events: none;
  opacity: .8;
}

/* ===== CHECKBOX Y RADIO ===== */
.checkbox,
.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox input,
.radio input {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #fff;
  cursor: pointer;
  transition: all .15s;
}

.checkbox input:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox input:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}

.radio input {
  border-radius: 50%;
}

.radio input:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.radio input:checked::after {
  content: "";
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

/* ===== FORMULARIOS ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  overflow: hidden;
}

.card__header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -24px -24px 24px -24px;
}

.card__header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}

.grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 900px) {
  .grid--2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid--2 .form-field--full {
    grid-column: 1 / -1;
  }
}

/* ===== CONTAINER Y HERO ===== */
.container {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px;
}

.hero {
  background: linear-gradient(90deg, var(--header-bg), var(--primary));
  color: #fff;
  padding: 38px 16px;
  text-align: center;
}

.hero__inner {
  max-width: 1100px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
}

.hero__sub {
  margin: 0;
  opacity: .9;
  font-size: 1rem;
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .95rem;
  margin-bottom: 16px;
}

.alert.success {
  background: #E6F4EA;
  color: var(--success);
  border: 1px solid rgba(27, 94, 32, 0.2);
}

.alert.error {
  background: #FDECEA;
  color: var(--danger);
  border: 1px solid rgba(198, 40, 40, 0.2);
}

.alert.info {
  background: #EAF3FF;
  color: var(--primary-600);
  border: 1px solid rgba(30, 144, 255, 0.2);
}

.form-summary {
  margin-bottom: 20px;
}

.form-summary ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.form-summary li {
  margin-bottom: 4px;
  cursor: pointer;
}

.form-summary li:hover {
  text-decoration: underline;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #112F46;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 1200;
  font-size: .95rem;
  font-weight: 500;
}

.toast.show {
  display: block;
}

/* ===== ACCESIBILIDAD ===== */
.btn:focus-visible,
.btn-create-community:focus-visible,
.form-field input:focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible,
.checkbox input:focus-visible,
.radio input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Fallback para navegadores que no soportan focus-visible */
.btn:focus,
.btn-create-community:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.checkbox input:focus,
.radio input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  /* Header responsive */
  .header-wrap {
    padding: 0 16px;
  }
  
  .logo img {
    height: 24px;
  }
  
  .header-left {
    gap: 16px;
  }
  
  .nav-left {
    gap: 12px;
  }
  
  .nav-left a,
  .nav-right a {
    font-size: .9rem;
  }
  
  .nav-right {
    gap: 12px;
  }
  
  .btn-login {
    padding: 5px 12px;
    font-size: .85rem;
  }
  
  .btn-accent {
    padding: 6px 14px;
    font-size: 0.9rem;
  }
  
  /* Botón Create Community responsive */
  .btn-create-community.mobile {
    width: 100%;
    text-align: center;
    margin: 8px 0;
    padding: 12px 20px;
    font-size: 1rem;
    margin-right: 0;
  }
  
  /* Drawer móvil responsive */
  .mobile-drawer {
    inset: 50px 0 0 0;
  }
  
  .mobile-menu {
    height: calc(100vh - 50px);
  }
  
  /* Hero responsive */
  .hero {
    padding: 24px 16px;
  }
  
  .hero h1 {
    font-size: 1.4rem;
  }
  
  .card__actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .container {
    padding: 0 12px;
    margin: 16px auto;
  }
  
  .card {
    padding: 20px;
  }
  
  .card__header {
    margin: -20px -20px 20px -20px;
    padding: 16px 20px;
  }
}

@media (max-width: 480px) {
  .grid {
    gap: 12px;
  }
  
  .card {
    padding: 16px;
  }
  
  .card__header {
    margin: -16px -16px 16px -16px;
    padding: 16px;
  }
  
  .card__actions {
    padding-top: 12px;
    margin-top: 16px;
  }
}

/* ===== HEADER PÚBLICO ===== */
.site-header {
  background: linear-gradient(90deg, var(--header-bg), var(--primary));
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.header-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 991.98px) {
  .header-wrap {
    height: 50px;
  }
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.logo img {
  height: 28px;
  width: auto;
}

/* Desktop navs */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.desktop-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 0 6px;
}

.desktop-nav a:hover {
  color: rgba(255,255,255,.85);
  text-decoration: underline;
}

/* Zona izquierda */
.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

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

.nav-left a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  transition: color .15s;
}

.nav-left a:hover {
  color: rgba(255,255,255,.85);
  text-decoration: underline;
}

/* Zona derecha: [Idioma] [Solicitar una demo] [Área Privada] — separación 10–14px */
.site-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-right a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  transition: color .15s;
}

.nav-right a:hover {
  color: rgba(255,255,255,.85);
}

/* CTA primario header: Solicitar una demo (fondo azul corporativo, texto blanco) */
.site-header .btn-demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  min-height: 40px;
  background: #0096E0;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, box-shadow .2s;
  box-shadow: 0 1px 4px rgba(0,150,224,.35);
}

.site-header .btn-demo:hover {
  background: #0080c4;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,150,224,.4);
}

/* CTA secundario header: Área Privada (outline, no compite con Demo) */
.site-header .btn-login {
  padding: 10px 18px;
  min-height: 40px;
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 10px;
  color: #fff;
  background: transparent;
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
  transition: background .2s, border-color .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-header .btn-login:hover {
  background: rgba(255,255,255,.15);
  border-color: #fff;
  color: #fff;
}

/* Fallback para headers que no usen .site-header */
.btn-login {
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
  transition: background .3s;
}

.btn-login:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Language selector (simple placeholder) */
.language-selector {
  color: #fff;
  cursor: pointer;
  user-select: none;
}

/* Hamburguesa (visible < 992px) */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  width: 44px;
  height: 32px;
  padding: 0;
  margin: 0 0 0 8px;
  cursor: pointer;
}

.nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 5px auto;
  transition: transform .2s, opacity .2s;
}

@media (max-width: 991.98px) {
  .desktop-nav {
    display: none;
  }
  .nav-toggle {
    display: block;
  }
}

/* Botón principal Create Community en el header */
.btn-create-community {
  background: linear-gradient(90deg, #00c6ff, #0072ff); /* degradado suave turquesa -> azul */
  color: #fff;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  border: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  cursor: pointer;
  letter-spacing: 0.5px;
  margin-right: 8px;
}

/* Hover con efecto glow */
.btn-create-community:hover {
  background: linear-gradient(90deg, #0099cc, #0055cc); /* tonos más oscuros */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 150, 255, 0.4); /* glow azul */
  color: #fff;
}

/* Active/Focus */
.btn-create-community:active,
.btn-create-community:focus {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 150, 255, 0.6);
  outline: none;
}

/* Botón de acento */
.btn-accent {
  background: var(--accent);
  color: #222 !important;
  border: none;
  border-radius: 16px;
  padding: 6px 16px;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: all .15s;
}

.btn-accent:hover {
  background: #E6951E;
  color: #222 !important;
  transform: translateY(-1px);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}

.dropdown-toggle::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 3px solid currentColor;
  margin-left: 3px;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 180px;
  padding: 8px 0;
  margin-top: 8px;
  display: none;
  z-index: 1001;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
}

.dropdown-item:hover {
  background: var(--muted);
  color: var(--text);
}

.dropdown-item-text {
  display: block;
  padding: 8px 16px;
  color: var(--text-2);
  font-size: .9rem;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
  border: none;
}

/* ===== USER DROPDOWN - OpenFinc ===== */

/* Avatar del usuario */
.user-dropdown {
  position: relative;
}

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: 20px;
  cursor: pointer;
  color: #fff;
  transition: background .15s;
}

.user-dropdown-toggle:hover {
  background: rgba(255,255,255,.12);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.avatar-text {
  line-height: 1;
}

.dropdown-arrow {
  transition: transform .15s;
  opacity: .8;
}

.user-dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

/* Menú desplegable */
.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid #E6EEF5;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 12px 0;
  min-width: 200px;
  z-index: 1100;
  list-style: none;
  margin: 0;
  color: #333333 !important;
}

.user-dropdown-menu[hidden] {
  display: none;
}

/* Evitar herencia de color blanco desde el header */
.user-dropdown-menu,
.user-dropdown-menu * {
  color: #333333 !important;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  text-decoration: none;
  color: #333333 !important;
  font-size: .9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background: #f0f4f8 !important;
  color: #0d6efd !important;
}

.item-icon {
  color: #6B7A89;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.user-dropdown-item:hover .item-icon {
  color: #0d6efd;
}

.user-dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 6px 0;
  border: none;
}

/* Formulario de logout */
.logout-form {
  margin: 0;
}

.logout-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 16px;
  cursor: pointer;
  color: #d9534f !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: #fdecea !important;
  color: #c9302c !important;
}

.logout-btn .item-icon {
  color: #d9534f;
  width: 18px;
  height: 18px;
}

.logout-btn:hover .item-icon {
  color: #c9302c;
}

/* Accesibilidad y foco */
.user-dropdown-item:focus,
.logout-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30,144,255,.25);
}

/* Banderas de idioma */
.user-dropdown-menu .flag-icon {
  width: 20px;
  height: 14px;
  display: inline-block;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset;
  flex-shrink: 0;
}

.user-dropdown-menu span {
  color: #333333 !important;
  display: flex;
  align-items: center;
}

/* Asegurar que todos los elementos del menú tengan contraste */
.user-dropdown-menu li {
  color: #333333 !important;
}

.user-dropdown-menu a {
  color: #333333 !important;
}

.user-dropdown-menu button {
  color: inherit !important;
}

/* Estilos específicos para el botón de logout */
.user-dropdown-menu .logout-btn {
  color: #d9534f !important;
}

.user-dropdown-menu .logout-btn:hover {
  background: #fdecea !important;
  color: #c9302c !important;
}

/* Asegurar que los iconos SVG tengan el color correcto */
.user-dropdown-menu .item-icon {
  color: #6B7A89 !important;
}

.user-dropdown-menu .user-dropdown-item:hover .item-icon {
  color: #0d6efd !important;
}

.user-dropdown-menu .logout-btn .item-icon {
  color: #d9534f !important;
}

.user-dropdown-menu .logout-btn:hover .item-icon {
  color: #c9302c !important;
}

/* Avatar legacy (mantener para compatibilidad) */
.avatar {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
}

/* Lang switcher */
.lang-switch {
  position: relative;
}

/* Selector de idioma: mini pill discreto (12–13px, sin protagonismo) */
.site-header .lang-switch .lang-btn-mini,
.site-header .lang-switch .lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  cursor: pointer;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}

.site-header .lang-switch .lang-btn-mini:hover,
.site-header .lang-switch .lang-btn:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.4);
  color: rgba(255,255,255,.9);
}

.site-header .lang-switch .lang-btn-mini .lang-code,
.site-header .lang-switch .lang-btn .lang-code {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.site-header .lang-switch .lang-btn-mini .lang-chevron {
  opacity: .8;
  flex-shrink: 0;
}

.site-header .lang-switch .flag-icon {
  width: 18px;
  height: 12px;
  display: inline-block;
  border-radius: 2px;
  opacity: .85;
  flex-shrink: 0;
  transition: opacity .15s;
}

.site-header .lang-switch .lang-btn:hover .flag-icon {
  opacity: 1;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  transition: background .15s;
}

.lang-btn:hover {
  background: rgba(255,255,255,.12);
}

.flag-icon {
  width: 24px;
  height: 16px;
  display: inline-block;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset;
}

/* Dropdown */
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid #E6EEF5;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  padding: 8px;
  min-width: 180px;
  z-index: 1100;
  list-style: none;
  margin: 0;
}

.lang-menu li {
  list-style: none;
}

.lang-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #0C1A24 !important;
  font-size: .9rem;
  transition: background .15s;
  font-weight: 500;
}

.lang-menu a:hover {
  background: #F5F8FB !important;
  color: #0C1A24 !important;
}

.lang-menu a:active {
  background: #E5EDF5 !important;
  color: #0C1A24 !important;
}

.lang-menu[hidden] {
  display: none;
}

/* Mobile styles */
.lang-switch.mobile {
  width: 100%;
}

.lang-btn.mobile {
  width: 100%;
  justify-content: flex-start;
  background: #EEF3F7;
  border: 1px solid #E6EEF5;
  color: #0C1A24;
  border-radius: 10px;
  padding: 10px;
}

.lang-btn.mobile:hover {
  background: #E5EDF5;
}

.lang-menu.mobile {
  position: static;
  margin-top: 8px;
  box-shadow: none;
  border: 1px solid #E6EEF5;
  background: #fff;
}

.lang-menu.mobile a {
  color: #0C1A24 !important;
}

.lang-menu.mobile a:hover {
  background: #F5F8FB !important;
  color: #0C1A24 !important;
}

/* A11y helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Language dropdown items */
.language-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-text {
  font-size: .9rem;
  color: var(--text);
}

/* Asegurar visibilidad del texto en el dropdown de idioma */
.lang-menu a,
.lang-menu.mobile a {
  color: #0C1A24 !important;
  font-weight: 500;
  text-shadow: none;
  text-decoration: none;
}

.lang-menu a:hover,
.lang-menu.mobile a:hover {
  background: #F5F8FB !important;
  color: #0C1A24 !important;
  text-shadow: none;
  text-decoration: none;
}

.lang-menu a:focus,
.lang-menu.mobile a:focus {
  background: #E5EDF5 !important;
  color: #0C1A24 !important;
  outline: 2px solid #1E90FF;
  outline-offset: -2px;
  text-decoration: none;
}

/* Asegurar que el dropdown sea visible */
.lang-menu {
  display: none;
}

.lang-menu:not([hidden]) {
  display: block;
}

/* Asegurar que el botón del idioma sea clickeable */
.lang-btn {
  cursor: pointer;
  user-select: none;
}

.lang-btn:focus {
  outline: 2px solid #1E90FF;
  outline-offset: 2px;
}

/* Drawer móvil */
.mobile-drawer {
  position: fixed;
  inset: 50px 0 0 0; /* debajo del header */
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(2px);
}

.mobile-menu {
  width: 86%;
  max-width: 360px;
  height: calc(100vh - 50px);
  background: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  padding: 16px;
  overflow: auto;
  transform: translateX(-100%);
  transition: transform .22s ease-out;
}

.mobile-drawer[aria-hidden="false"] .mobile-menu,
.mobile-drawer.show .mobile-menu {
  transform: translateX(0);
}

.mobile-link {
  display: block;
  padding: 12px;
  border-radius: 10px;
  color: #0C1A24;
  text-decoration: none;
  font-weight: 600;
}

.mobile-link:hover {
  background: #F5F8FB;
}

/* Botón Create Community en móvil */
.mobile-link.btn-create-community.mobile {
  background: linear-gradient(90deg, #00c6ff, #0072ff);
  color: #fff;
  border-radius: 20px;
  margin: 8px 0;
  text-align: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-right: 0;
}

.mobile-link.btn-create-community.mobile:hover {
  background: linear-gradient(90deg, #0099cc, #0055cc);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 150, 255, 0.4);
}

.mobile-group {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid #E6EEF5;
  margin-top: 8px;
}

.language-selector.mobile {
  background: #EEF3F7;
  border: 1px solid #E6EEF5;
  border-radius: 10px;
  padding: 10px;
  color: #0C1A24;
  text-align: left;
  text-decoration: none;
  display: block;
}

/* Móvil: CTA Demo = primario; Área Privada = secundario */
.btn-demo.mobile {
  display: block;
  text-align: center;
  background: #0096E0;
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  transition: background .2s;
}

.btn-demo.mobile:hover {
  background: #0080c4;
  color: #fff;
}

.btn-login.mobile {
  display: block;
  text-align: center;
  background: transparent;
  color: #0C1A24;
  border: 2px solid #E6EEF5;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
}

.btn-login.mobile:hover {
  background: #F5F8FB;
  border-color: #1E90FF;
  color: #0C1A24;
}

/* Evitar que el header tape contenido */
main {
  padding-top: 16px; /* el header es sticky, no fixed, así que no debería tapar; ajusta si hace falta */
}

/* ===== ANIMACIONES ===== */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast.show {
  animation: slideIn 0.3s ease;
}

.toast.slideOut {
  animation: slideOut 0.3s ease;
}
