/* ==========================================================
   SENDA CONSCIENTE — TEMA CLARO PREMIUM (EDICIÓN PATEK)
   Luminoso · Elegante · Minimalista · Aireado · Premium
   ========================================================== */

:root {
  --color-bg: #f8f7f4;               /* Fondo cálido y luminoso */
  --color-bg-secondary: #ffffff;     /* Paneles claros */
  --color-text: #1a1a1a;             /* Texto principal */
  --color-muted: #5a5a5a;            /* Texto secundario */
  --color-accent: #c6a664;           /* Oro suave */
  --color-hover: #b79846;            /* Oro más intenso */
  --color-border: #ddd;              /* Líneas suaves */
  --radius-base: 8px;
  --shadow-soft: 0 2px 6px rgba(0,0,0,0.05);
  --shadow-medium: 0 4px 14px rgba(0,0,0,0.08);
  --transition-speed: 0.35s;
}

/* ==========================================================
   BASE GENERAL
   ========================================================== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Lato', sans-serif;
  line-height: 1.65;
  background: var(--color-bg);
  color: var(--color-text);
  transition:
    background-color var(--transition-speed) ease,
    color var(--transition-speed) ease;
}

* {
  box-sizing: border-box;
  transition:
    background-color .25s ease,
    color .25s ease,
    border-color .25s ease;
}

main.main-content {
  flex: 1 0 auto;
  padding-top: 80px;
  animation: fadeInSmooth 1.0s ease-out both;
}

/* ==========================================================
   HEADER + NAV — Premium Claro
   ========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: background 0.35s ease, box-shadow 0.35s ease, padding 0.35s ease;
}

.site-header.compact {
  background: var(--color-bg-secondary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65em 1.1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: padding 0.35s ease;
}

.site-header.compact .header-inner {
  padding: 0.45em 1.1em;
}

.logo img {
  height: 40px;
  transition: opacity var(--transition-speed) ease;
}
.logo:hover img { opacity: 0.85; }

nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Enlaces de navegación */
nav a {
  color: var(--color-text);
  padding: 0.25rem 0.5rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: 999px;
  font-size: 0.94rem;
  opacity: 0.88;
  border: 1px solid transparent;
  transition:
    color 0.25s ease,
    background 0.25s ease,
    opacity 0.25s ease,
    border-color 0.25s ease;
}

nav a:hover {
  opacity: 1;
  color: var(--color-accent);
  background: rgba(198,166,100,0.06);
  border-color: rgba(198,166,100,0.26);
}

/* Botón de tema */
.btn-theme {
  background: transparent;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 0.35rem 0.9rem;
  font-size: 0.86rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  box-shadow: none;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    transform 0.1s ease;
}

.btn-theme:hover {
  background: rgba(198,166,100,0.06);
  border-color: rgba(198,166,100,0.35);
  color: var(--color-accent);
  transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  nav {
    width: 100%;
    justify-content: flex-start;
    margin-top: 0.35rem;
  }

  nav a {
    margin: 0 0.25rem 0.25rem 0;
  }

  .btn-theme {
    margin-left: auto;
  }
}

/* ==========================================================
   BOTONES GENERALES
   ========================================================== */
button,
.btn,
.btn-primary {
  background-color: var(--color-accent);
  color: #111;
  border: none;
  padding: 0.55em 1.4em;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background-color .25s ease, transform .1s ease, box-shadow .25s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

button:hover,
.btn:hover,
.btn-primary:hover {
  background-color: var(--color-hover);
  box-shadow: 0 3px 10px rgba(183,152,70,0.28);
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  padding: 0.4em 1.2em;
  border-radius: 7px;
  transition: all .25s ease;
}

.btn-ghost:hover {
  background: var(--color-accent);
  color: #111;
}

/* ==========================================================
   TARJETAS / PANEL / BOX
   ========================================================== */
.card,
.box,
.panel {
  background-color: var(--color-bg-secondary);
  border: 1px solid rgba(221,221,221,0.75);
  border-radius: var(--radius-base);
  padding: 1.15em;
  box-shadow: var(--shadow-soft);
}

.card:hover,
.panel:hover {
  box-shadow: var(--shadow-medium);
}

/* ==========================================================
   FORMULARIOS
   ========================================================== */
input,
select,
textarea {
  background-color: var(--color-bg-secondary);
  border: 1px solid rgba(221,221,221,0.8);
  border-radius: 4px;
  padding: 0.5em 0.8em;
  color: var(--color-text);
  transition: border .2s ease, box-shadow .2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(198,166,100,0.15);
}

/* ==========================================================
   TABLAS Y ALERTAS
   ========================================================== */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--color-border);
  padding: 0.7em;
}

th {
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.alert {
  background-color: #fffbe9;
  border-left: 4px solid var(--color-accent);
  color: #4b4a47;
  padding: 1em;
  border-radius: 4px;
}

/* ==========================================================
   FOOTER — Premium sin degradado
   ========================================================== */
footer {
  background: var(--color-bg-secondary) !important;
  flex-shrink: 0;
  text-align: center;
  padding: 1.4em 0 1.8em;
  color: var(--color-text);
  border-top: 1px solid rgba(221,221,221,0.7);
  box-shadow: 0 -2px 4px rgba(0,0,0,0.035);
}

footer .footer-links a {
  color: inherit;
  margin: 0 .25rem;
  transition: color .2s ease;
}

footer .footer-links a:hover {
  color: var(--color-accent);
}

footer .social-icons img {
  height: 22px;
  margin: .3rem .18rem 0;
  transition: filter .25s ease, transform .25s ease;
}

footer .social-icons img:hover {
  transform: scale(1.03);
  filter: saturate(1.1);
}

/* ==========================================================
   SCROLLBAR
   ========================================================== */
::-webkit-scrollbar { width: 8px; }

::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-accent);
}

/* ==========================================================
   CHAT GENERAL (usuario)
   ========================================================== */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  max-width: 720px;
  margin: 30px auto;
  border: 1px solid rgba(221,221,221,0.7);
  border-radius: 12px;
  background: var(--color-bg-secondary);
  box-shadow: var(--shadow-soft);
  overflow: hidden; /* garantiza que #chat-box no rompa el layout */
}


/* Chat messages */
.message {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 75%;
  word-break: break-word;
  line-height: 1.4;
  font-size: 0.95rem;
  margin: 2px 0;
  animation: chatPop .25s ease;
}

.message.received {
  align-self: flex-start;
  background: #e9e7e3;
  color: #111;
}

.message.sent {
  align-self: flex-end;
  background: var(--color-accent);
  color: #111;
}

/* ==========================================================
   ANIMACIONES
   ========================================================== */
@keyframes fadeInSmooth {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes chatPop {
  from { transform: translateY(3px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
/* ==========================================================
   CHAT FIX — alineación y separación correcta
   ========================================================== */

/* Contenedor de mensajes (usuario y admin) */
#chat-box,
.admin-chat-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Burbuja base */
.message {
  display: inline-flex;          /* IMPORTANTE */
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 75%;
  word-break: break-word;
  line-height: 1.4;
  font-size: 0.95rem;
  margin: 2px 0;
}
/* ==========================================================
   ADMIN CHAT — layout estable en modo claro
   ========================================================== */

/* Sección envolvente del panel admin */
.admin-section {
  background: #f8f7f4;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Contenedor principal del chat admin */
.admin-chat-main {
  display: flex;
  height: 70vh;
  min-height: 520px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
}

/* Columna izquierda: lista de usuarios */
.admin-chat-usuarios {
  width: 25%;
  min-width: 220px;
  background: #fcfbf9;
  border-right: 1px solid #ddd;
  overflow-y: auto;
}

.admin-chat-usuarios .user-item {
  padding: 10px 14px;
  border-bottom: 1px solid #e4e2dd;
  color: #2a2a2a;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.admin-chat-usuarios .user-item:hover {
  background: #f3ede2;
  color: #b08b3a;
}

/* Columna derecha: área de conversación */
.admin-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fbfaf8;
}

/* Caja de mensajes del admin */
.admin-chat-box {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;              /* reafirma el CHAT FIX */
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

/* Footer (input + botón) del admin */
.admin-chat-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #ddd;
  padding: 10px;
  background: #fff;
}

.admin-chat-footer input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.95rem;
}

.admin-chat-footer button {
  background: #c6a664;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.admin-chat-footer button:hover {
  background: #b99744;
}
/* ==========================================================
   ADMIN CHAT — indicador rojo de mensajes no leídos
   ========================================================== */
.admin-chat-usuarios .badge {
  background: #d9534f !important;   /* rojo bootstrap-like */
  color: #fff !important;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  float: right;
  margin-top: 2px;
}
/* ==========================================================
   CHAT USUARIO — Contenedor de mensajes (faltaba)
   ========================================================== */
#chat-box {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-bg-secondary);
  scroll-behavior: smooth;
  border-top: 1px solid rgba(0,0,0,0.05);
}
/* ==========================================================
   CHAT USUARIO — Footer con input y botón
   ========================================================== */
.chat-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: var(--color-bg-secondary);
  border-top: 1px solid rgba(0,0,0,0.08);
}

.chat-footer .row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.chat-footer input#msg {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
}

.chat-footer button#btnEnviar {
  background: var(--color-accent);
  color: #111;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}

.chat-footer button#btnEnviar:hover {
  background: var(--color-hover);
}
/* Indicador "escribiendo" */
.typing-indicator {
  font-size: 0.85rem;
  color: var(--color-muted);
  padding-left: 4px;
}
/* ==========================================================
   FIX FOOTER — Mantener el footer pegado abajo en páginas cortas
   ========================================================== */

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

main,
.main-content {
  flex: 1 0 auto;
  min-height: calc(100vh - 180px); /* altura real del header + footer */
}

footer.footer {
  flex-shrink: 0;
}
/* =====================================================
   LOGIN PAGE — Ajuste perfecto sin romper el layout
   ===================================================== */

body.login-page {
  display: block !important;      /* Cancelamos el flex global */
  min-height: 100vh;              /* Garantiza pantalla completa */
  position: relative;
  padding-bottom: 140px;          /* Altura real del footer */
}

body.login-page footer.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
}
/* ===================================================================
   ESTILOS MEJORADOS PARA BANNER DE COOKIES
   Añadir al final de style.css o como archivo separado
   =================================================================== */

/* === Banner de cookies mejorado === */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: var(--color-bg-secondary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.2em 1.5em;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 999;
    animation: fadeInSmooth 0.6s ease;
    max-width: 90%;
    text-align: center;
}

.cookie-banner span {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

/* Contenedor de botones */
.cookie-banner-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Botón Aceptar destacado */
.cookie-banner #acceptCookies {
    background: var(--color-accent);
    color: #111;
    font-weight: 600;
    border: none;
    padding: 0.7em 2em;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    min-height: 44px;
    box-shadow: 0 2px 8px rgba(198,166,100,0.3);
}

.cookie-banner #acceptCookies:hover {
    background: rgba(198,166,100,1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(198,166,100,0.4);
}

/* Botón Más info secundario */
.cookie-banner .btn-ghost {
    background: transparent;
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
    padding: 0.7em 1.5em;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    transition: all 0.3s ease;
}

.cookie-banner .btn-ghost:hover {
    background: rgba(198,166,100,0.1);
    border-color: var(--color-accent);
}

/* Modo oscuro */
body.dark .cookie-banner {
    background: var(--dark-bg-2);
    border-color: var(--dark-border);
    box-shadow: 0 4px 24px rgba(0,0,0,0.6);
}

body.dark .cookie-banner span {
    color: var(--dark-text);
}

body.dark .cookie-banner #acceptCookies {
    background: var(--dark-accent);
    color: #111;
}

body.dark .cookie-banner #acceptCookies:hover {
    background: rgba(198,166,100,1);
}

body.dark .cookie-banner .btn-ghost {
    color: var(--dark-accent);
    border-color: var(--dark-accent);
}

body.dark .cookie-banner .btn-ghost:hover {
    background: rgba(198,166,100,0.15);
}

/* Responsive */
@media (min-width: 600px) {
    .cookie-banner {
        flex-direction: row;
        max-width: 600px;
        text-align: left;
    }
    
    .cookie-banner span {
        margin-bottom: 0;
        flex: 1;
    }
    
    .cookie-banner-buttons {
        flex-shrink: 0;
        width: auto;
    }
}

@media (max-width: 599px) {
    .cookie-banner {
        width: 90%;
        padding: 1em 1.2em;
    }
    
    .cookie-banner-buttons {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .cookie-banner #acceptCookies,
    .cookie-banner .btn-ghost {
        width: 100%;
    }
}