:root {
    --primary: #6a0dad;      /* Morado principal */
    --primary-dark: #4b0082; /* Morado oscuro */
    --accent: #ffd700;       /* Dorado */
    --bg-dark: #1a1a2e;      /* Fondo Sidebar */
    --bg-light: #f4f6f9;     /* Fondo Panel */
    --text-dark: #333;
    --white: #ffffff;
    --sidebar-width: 250px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    display: flex;
    height: 100vh;
    overflow: hidden; /* Evita doble scroll en Admin */
}

/* =========================================
   ADMIN PANEL (SIDEBAR & CONTENT)
   ========================================= */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    transition: 0.3s;
    z-index: 100;
}

.sidebar h2 {
    color: var(--accent);
    text-align: center;
    margin-bottom: 40px;
    font-size: 22px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.menu-item {
    display: block;
    padding: 15px;
    color: #ccc;
    text-decoration: none;
    margin-bottom: 10px;
    border-radius: 8px;
    transition: 0.3s;
    font-weight: 500;
}

.menu-item:hover, .menu-item.active {
    background-color: var(--primary);
    color: white;
    transform: translateX(5px);
}

.menu-item.logout {
    margin-top: auto;
    background-color: #c0392b;
    color: white;
    text-align: center;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
    height: 100vh;
    overflow-y: auto;
}

.header-title {
    margin-bottom: 30px;
    color: var(--primary-dark);
}

/* Cards Admin */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-top: 4px solid var(--primary);
}

.card h3 { margin-top: 0; color: var(--text-dark); }

/* Formularios Admin */
label { font-size: 14px; color: #666; font-weight: bold; display: block; margin-top: 10px;}
input, select {
    width: 100%;
    padding: 12px;
    margin-top: 5px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
}
input:focus, select:focus { border-color: var(--primary); outline: none; background: white; }

button.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
}
button.btn-primary:hover { background: var(--primary-dark); }

/* Tablas Admin */
.table-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 600px; table-layout: fixed; word-wrap: break-word;  }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
th { background-color: #f8f9fa; color: #555; font-weight: 600; }
.badge { padding: 5px 10px; border-radius: 15px; font-size: 12px; font-weight: bold; }
.badge.active { background: #d4edda; color: #155724; }
.badge.closed { background: #f8d7da; color: #721c24; }
.link-input { border: none; background: #eee; padding: 5px; width: 100%; cursor: pointer; color: var(--primary); }

/* Responsive Admin */
@media (max-width: 768px) {
    body { flex-direction: column; height: auto; overflow: auto; }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
        white-space: nowrap;
    }
    .sidebar h2 { display: none; }
    .menu-item { margin-bottom: 0; margin-right: 10px; padding: 10px; font-size: 14px; }
    .menu-item.logout { margin-left: auto; margin-top: 0; }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
        height: auto;
    }
}

/* =========================================
   NUEVO DISEÑO CHAT (CON SIDEBAR DERECHO)
   ========================================= */

.chat-body {
    background-color: #1a1a2e; /* Fondo oscuro de la página */
    background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
    height: 100vh;
    display: flex;
    align-items: center;     /* Centrado vertical */
    justify-content: center; /* Centrado horizontal */
    padding: 20px;           /* Márgenes alrededor de la sala */
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* El Contenedor Principal (La Tarjeta) */
.chat-layout-wrapper {
    display: flex;
    width: 100%;
    max-width: 1100px;       /* Ancho máximo en PC */
    height: 90vh;            /* Altura máxima */
    background: white;
    border-radius: 20px;     /* Bordes redondeados */
    overflow: hidden;        /* Para que nada se salga */
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* Columna Izquierda: El Chat */
.chat-main-area {
    flex: 2; /* Ocupa 2/3 del espacio */
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
    position: relative;
}

.chat-header {
    background: #6a0dad;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

.chat-header h3 { margin: 0; font-size: 18px; }
.chat-header small { color: #e0e0e0; font-size: 13px; }

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #e5ddd5; /* Fondo tipo WhatsApp */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-area {
    background: #f0f0f0;
    padding: 15px;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
}

textarea {
    flex: 1;
    border-radius: 20px;
    border: 1px solid #ccc;
    padding: 10px 15px;
    height: 45px;
    resize: none;
    outline: none;
    font-family: inherit;
}

#send-btn {
    background: #6a0dad;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
#send-btn:hover { background: #4b0082; transform: scale(1.05); }
#send-btn:disabled { background: #ccc; cursor: not-allowed; }

/* Columna Derecha: Información (Sidebar) */
.chat-sidebar-info {
    flex: 1; /* Ocupa 1/3 del espacio */
    background: #f8f9fa;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-left: 4px solid #ffd700;
}

.info-card h4 { margin-top: 0; color: #6a0dad; font-size: 16px; }
.info-card p { font-size: 14px; color: #555; line-height: 1.5; margin-bottom: 10px; }

.btn-call-action {
    display: block;
    width: 100%;
    background: linear-gradient(45deg, #ff4757, #ff6b81);
    color: white;
    text-align: center;
    padding: 15px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
    transition: 0.3s;
    animation: pulse-btn 2s infinite;
}
.btn-call-action:hover { transform: translateY(-3px); }

@keyframes pulse-btn {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Mensajes del Chat */
.message { max-width: 80%; display: flex; flex-direction: column; position: relative; }
.message.me { align-self: flex-end; align-items: flex-end; }
.message.me .bubble { background: #dcf8c6; color: #333; border-radius: 10px 0 10px 10px; box-shadow: 0 1px 1px rgba(0,0,0,0.1); }
.message.other { align-self: flex-start; align-items: flex-start; }
.message.other .bubble { background: #ffffff; color: #333; border-radius: 0 10px 10px 10px; box-shadow: 0 1px 1px rgba(0,0,0,0.1); }
.sender-name { font-size: 11px; margin-bottom: 3px; font-weight: bold; color: #555; }
.message.me .sender-name { display: none; } 
.message.other .sender-name { color: #6a0dad; margin-left: 5px; }
.bubble { padding: 10px 14px; font-size: 15px; line-height: 1.4; position: relative; word-wrap: break-word; }
.msg-meta { display: block; text-align: right; font-size: 10px; color: #999; margin-top: 4px; }

/* Responsive Móvil Chat */
@media (max-width: 768px) {
    .chat-body { padding: 0; height: 100vh; display: block; }
    .chat-layout-wrapper { 
        flex-direction: column; 
        border-radius: 0; 
        height: 100%; 
        max-width: 100%; 
    }
    .chat-main-area { flex: 3; height: 70%; } /* Chat ocupa el 70% */
    .chat-sidebar-info { 
        flex: 1; 
        height: 30%; 
        padding: 15px; 
        border-top: 2px solid #ffd700;
        background: #fff;
    }
    .info-card { padding: 10px; margin-bottom: 10px; font-size: 12px; }
    .btn-call-action { padding: 10px; font-size: 14px; }
}

/* =========================================
   LOGIN PAGE
   ========================================= */

/* --- LOGIN & REGISTER RESCATE --- */
.login-body { 
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #4b0082 100%); 
    min-height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 20px;
    box-sizing: border-box;
}

/* Esta es la caja blanca que se rompió */
.login-card { 
    background: #ffffff !important; /* Fondo blanco sólido */
    width: 100%; 
    max-width: 380px; 
    padding: 30px; 
    border-radius: 20px; 
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3); 
    text-align: center; 
    border-top: 6px solid #ffd700; /* Línea dorada superior */
    box-sizing: border-box;
}

.login-card h2 {
    color: #333; /* Texto oscuro para que se vea sobre el blanco */
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
}

.input-group {
    margin-bottom: 12px; /* Espacio entre cada campo */
}

.input-group input, 
.input-group select { 
    width: 100%; 
    padding: 12px; 
    border: 1px solid #ddd; 
    border-radius: 10px; 
    font-size: 15px;
    background-color: #fdfdfd;
    box-sizing: border-box; /* Evita que los campos se salgan de la caja */
}

.btn-login { 
    width: 100%; 
    padding: 14px; 
    background: #6a0dad; 
    color: white; 
    border: none; 
    border-radius: 10px; 
    cursor: pointer; 
    font-weight: bold;
    font-size: 16px;
    margin-top: 10px;
    transition: 0.3s;
}

.btn-login:hover {
    background: #5a009d;
    transform: translateY(-2px);
}

.login-card p, .login-card a {
    font-size: 14px;
    margin-top: 15px;
    color: #555;
}

/* Aseguramos que el body general permita scroll si el contenido lo requiere */
body {
    height: auto !important;
    overflow-y: auto !important;
}

.login-wrapper { width: 100%; padding: 20px; display: flex; justify-content: center; }

./* --- LOGIN & REGISTER COMPACTO --- */
.login-card { 
    background: rgba(255, 255, 255, 0.95); 
    width: 100%; 
    max-width: 400px; 
    padding: 25px 35px; /* Reducido de 40px */
    border-radius: 20px; 
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3); 
    text-align: center; 
    border-top: 5px solid #ffd700; 
}

.login-card h2 {
    margin-bottom: 15px; /* Espacio bajo el título "Crea tu Cuenta" */
    font-size: 24px;
}

.input-group input, .input-group select { 
    width: 100%; 
    padding: 10px; /* Reducido de 12px */
    margin: 6px 0; /* Reducido de 10px */
    border: 1px solid #ddd; 
    border-radius: 8px; 
    font-size: 15px;
    box-sizing: border-box;
}

.btn-login { 
    width: 100%; 
    padding: 12px; 
    background: #6a0dad; 
    color: white; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: bold;
    margin-top: 10px; /* Espacio antes del botón */
}

.login-icon {
    font-size: 50px; color: #6a0dad; margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(106, 13, 173, 0.3);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.login-card h2 { margin: 10px 0 5px; color: #333; font-size: 24px; }
.subtitle { color: #666; font-size: 14px; margin-bottom: 30px; }

.input-group { position: relative; margin-bottom: 20px; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: 14px; }
.input-group input {
    width: 100%; padding: 12px 15px 12px 40px;
    border: 1px solid #ddd; border-radius: 25px;
    outline: none; transition: 0.3s; background: #f9f9f9;
    font-size: 15px; box-sizing: border-box;
}
.input-group input:focus { border-color: #6a0dad; background: #fff; box-shadow: 0 0 8px rgba(106, 13, 173, 0.1); }
.input-group input::placeholder { color: #bbb; }

.btn-login {
    width: 100%; padding: 14px;
    background: linear-gradient(to right, #6a0dad, #8a2be2);
    color: white; border: none; border-radius: 25px;
    font-size: 16px; font-weight: bold; cursor: pointer;
    transition: 0.3s; box-shadow: 0 5px 15px rgba(106, 13, 173, 0.3);
}
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(106, 13, 173, 0.4);
    background: linear-gradient(to right, #580a91, #7b1fa2);
}

.error-msg {
    background: #ffeded; color: #d63031; padding: 10px;
    border-radius: 8px; font-size: 13px; margin-bottom: 20px;
    border: 1px solid #ffcece; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.footer-login { margin-top: 30px; font-size: 12px; color: #999; }

@media (max-width: 480px) { .login-card { padding: 30px 20px; } }

/* =========================================
   LANDING PAGE (INDEX)
   ========================================= */

.landing-body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0; padding: 0; background-color: #f4f6f9; color: #333;
}

.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 40px; background: #1a1a2e; color: white;
}
.logo { font-size: 24px; font-weight: bold; color: #fff; display: flex; align-items: center; gap: 10px; }
.logo span { color: #ffd700; }

.btn-staff {
    text-decoration: none; color: rgba(255,255,255,0.7); font-size: 14px;
    border: 1px solid rgba(255,255,255,0.2); padding: 8px 15px;
    border-radius: 20px; transition: 0.3s;
}
.btn-staff:hover { background: rgba(255,255,255,0.1); color: white; }

.hero-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #4b0082 100%);
    padding: 80px 20px; text-align: center; color: white;
    position: relative; overflow: hidden;
}
.hero-section::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
    opacity: 0.3; pointer-events: none;
}
.hero-content { max-width: 700px; margin: 0 auto; position: relative; z-index: 1; }
.badge-promo {
    background: rgba(255, 215, 0, 0.2); color: #ffd700;
    padding: 5px 15px; border-radius: 20px; font-size: 14px;
    font-weight: bold; border: 1px solid #ffd700; display: inline-block; margin-bottom: 20px;
}
.hero-content h1 { font-size: 48px; margin: 0 0 20px 0; line-height: 1.2; }
.hero-content p { font-size: 18px; color: #dcdcdc; margin-bottom: 40px; line-height: 1.6; }

.btn-whatsapp {
    display: inline-block; background-color: #25D366; color: white;
    text-decoration: none; font-size: 20px; font-weight: bold;
    padding: 18px 40px; border-radius: 50px;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
    transition: 0.3s; animation: pulse 2s infinite;
}
.btn-whatsapp:hover { background-color: #1ebc57; transform: translateY(-5px); box-shadow: 0 15px 30px rgba(37, 211, 102, 0.5); }
.btn-whatsapp i { margin-right: 10px; font-size: 24px; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
.small-text { font-size: 14px; color: #aaa; margin-top: 15px; }

.steps-section { padding: 60px 20px; text-align: center; background: white; }
.steps-section h2 { color: #1a1a2e; margin-bottom: 50px; font-size: 32px; }
.steps-grid { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; max-width: 1000px; margin: 0 auto; }
.step-card {
    flex: 1; min-width: 250px; padding: 30px; background: #fff;
    border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: 0.3s; border: 1px solid #eee;
}
.step-card:hover { transform: translateY(-10px); }
.icon-box {
    width: 70px; height: 70px; background: #fdf6e3; color: #d4a017;
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 30px; margin: 0 auto 20px auto;
}
.step-card h3 { color: #333; margin-bottom: 10px; }
.step-card p { color: #666; font-size: 15px; line-height: 1.5; }

.landing-footer { background: #16213e; color: #666; text-align: center; padding: 30px; font-size: 14px; }

@media (max-width: 768px) {
    .hero-content h1 { font-size: 32px; }
    .btn-whatsapp { width: 90%; font-size: 18px; padding: 15px 20px; box-sizing: border-box; }
    .steps-grid { flex-direction: column; }
    .navbar { padding: 15px 20px; }
}

/* =========================================
   ALERTAS & NOTIFICACIONES
   ========================================= */

.badge-alert {
    display: inline-block;
    background-color: #ff0000; /* Rojo puro */
    color: #fff;
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    padding: 8px 12px;
    border-radius: 50px;
    margin-top: 5px;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
    border: 2px solid white;
    animation: panic-pulse 0.8s infinite alternate;
}

@keyframes panic-pulse {
    0% { transform: scale(1); box-shadow: 0 0 5px rgba(255, 0, 0, 0.5); }
    100% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 0, 0, 0.9); }
}

/* ============================================= */
/* ==   ESTILOS PARA MENSAJES DE FEEDBACK     == */
/* ============================================= */

.alert-box {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 500;
}

/* Estilo para mensajes de ÉXITO (Verde) */
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

/* Estilo para mensajes de ADVERTENCIA (Amarillo) */
.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

/* Estilo para mensajes de ERROR o PELIGRO (Rojo) */
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =========================================
   CORRECCIÓN FINAL PARA INDEX (SCROLL)
   ========================================= */
/* Esto fuerza el scroll en la landing page anulando el overflow hidden del admin */
body.landing-body {
    display: block !important;
    height: auto !important;
    min-height: 100vh;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    background-color: #f4f6f9 !important;
}

.landing-body .navbar,
.landing-body .hero-section,
.landing-body .steps-section,
.landing-body .landing-footer {
    width: 100% !important;
    display: block !important;
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    box-sizing: border-box !important;
}

.landing-body .navbar {
    display: flex !important;
    justify-content: space-between;
}

.landing-body .hero-section {
    min-height: 80vh;
    padding-top: 60px;
    padding-bottom: 60px;
}

.landing-body .steps-section {
    padding: 60px 20px;
    background: white;
}
/* ============================================= */
/* ==   ESTILOS PARA BOTONES DE ACCIÓN        == */
/* ============================================= */

/* Botón verde de ÉXITO (Atendido) */
.btn-success {
    background-color: #28a745; /* Verde éxito */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    text-decoration: none;
    transition: background-color 0.2s;
}
.btn-success:hover {
    background-color: #218838; /* Verde más oscuro */
}

/* Botón rojo de PELIGRO (Eliminar) */
.btn-danger {
    background-color: #dc3545; /* Rojo peligro */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}
.btn-danger:hover {
    background-color: #c82333;
}
/* Estilo específico para el enlace de Iniciar Sesión */
.login-card p a {
    color: #007bff !important; /* Color azul profesional */
    text-decoration: none;     /* Quita el subrayado inicial */
    font-weight: bold;         /* Lo hace más legible */
    transition: 0.3s;          /* Suaviza el cambio de color */
}

.login-card p a:hover {
    color: #0056b3 !important; /* Un azul más oscuro al pasar el ratón */
    text-decoration: underline; /* Se subraya al pasar el ratón */
}
/* --- AJUSTES PARA MÓVILES (LOGIN Y REGISTRO) --- */
@media (max-width: 480px) {
    .login-body {
        padding: 10px; /* Menos margen exterior */
        align-items: flex-start; /* Alinea arriba para que no se corte si el teclado sube */
        padding-top: 50px;
    }

    .login-card {
        width: 100%;    /* Ocupa todo el ancho */
        max-width: 100%; 
        padding: 25px 20px; /* Espacio interno cómodo */
        border-radius: 15px;
        box-shadow: none; /* Quitamos sombra pesada para limpiar el diseño */
    }

    .login-card h2 {
        font-size: 26px; /* Título más grande y legible */
        margin-bottom: 25px;
    }

    .input-group input, 
    .input-group select {
        font-size: 16px !important; /* Tamaño mínimo recomendado para que el iPhone no haga zoom raro */
        padding: 15px; /* Campos más altos para pulsar bien con el dedo */
        margin-bottom: 15px;
    }

    .btn-login {
        padding: 16px; /* Botón más grande */
        font-size: 18px;
        margin-top: 15px;
    }

    .login-card p {
        font-size: 15px; /* Texto de abajo más legible */
        line-height: 1.6;
    }
}