/* Estilos para el Chat - Línea Gráfica Magistral 2025 */

/* Importar fuentes */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Montserrat:wght@700;800;900&display=swap');

/* Variables de colores de marca */
:root {
    /* Nueva paleta: negro + azul brillante con tema poker */
    --brand-burgundy: #0a0a0f;
    --brand-blue: #2196F3;
    --brand-blue-dark: #1976D2;
    --brand-blue-light: #64B5F6;
    --brand-dark: #000000;
    --brand-dark-2: #0a0a14;
    --brand-dark-3: #1a1a2e;
    --chat-bg: #0f0f1a;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.65);
    --border-color: rgba(33, 150, 243, 0.3);
    --input-bg: rgba(33, 150, 243, 0.05);
    --card-bg: linear-gradient(180deg, var(--brand-dark-2) 0%, var(--brand-dark-3) 100%);
    --poker-spade: #2196F3;
    --poker-heart: #F44336;
    --poker-diamond: #FF9800;
    --poker-club: #4CAF50;
}

/* Configuración general */
* {
    box-sizing: border-box;
}

body {
    background: var(--brand-dark);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

/* Scroll personalizado */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--brand-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--brand-blue);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(33,150,243,.5);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-blue-light);
    box-shadow: 0 0 15px rgba(33,150,243,.7);
}

/* Contenedor principal */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 800px;
    height: auto;
    padding: 20px 16px;
}

/* Tarjetas (Registro, Login, Bienvenida) */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

/* Secciones de formularios */
#register-section,
#login-section {
    width: 100%;
    max-width: 500px;
    padding: 28px;
}

#register-section h5,
#login-section h5 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

/* Labels */
.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

/* Inputs */
.form-control {
    background: var(--input-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: rgba(33, 150, 243, 0.08);
    border-color: var(--brand-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2), 0 0 15px rgba(33, 150, 243, 0.3);
    outline: none;
}

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

.form-control:disabled {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Botones principales */
.btn {
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 10px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4), inset 0 0 20px rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--brand-blue-light) 0%, var(--brand-blue) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.6), inset 0 0 30px rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.6);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: rgba(33, 150, 243, 0.2);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: rgba(33, 150, 243, 0.1);
}

/* Botones outline */
.btn-outline-primary {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-outline-primary:hover {
    background: rgba(33, 150, 243, 0.1);
    border-color: var(--brand-blue);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.3);
}

/* Texto muted */
.text-muted {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
}

/* Sección de bienvenida */
#welcome-section {
    width: 100%;
    max-width: 100%;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px;
    margin-bottom: 16px;
}

#welcome-section h5 {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    word-wrap: break-word;
    line-height: 1.5;
    margin: 0;
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--brand-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
}

/* Sección de chat */
#chat-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Botón de asistencia */
#assistance-container {
    margin-bottom: 16px;
}

#assistButton {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: white;
    font-weight: 600;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(33, 150, 243, 0.4);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4), inset 0 0 20px rgba(33, 150, 243, 0.1);
    position: relative;
}

#assistButton::before {
    content: "♠";
    position: absolute;
    left: 15px;
    opacity: 0.3;
    font-size: 18px;
}

#assistButton:hover {
    background: linear-gradient(135deg, var(--brand-blue-light) 0%, var(--brand-blue) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.6), inset 0 0 30px rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.6);
}

#assist-timer {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 8px;
}

/* Área de mensajes - CON FONDO #211d1d */
#messages {
    width: 100%;
    height: 70vh;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Contenedor del input */
#input-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

/* Input de mensaje */
#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

/* Botón de enviar */
#sendMessage {
    padding: 12px;
    font-size: 0.95rem;
    min-width: 100px;
    font-weight: 600;
}

/* Contador de caracteres */
#charCounter {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 4px;
}

/* Countdown */
#countdown {
    color: var(--text-secondary) !important;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    margin-top: 8px;
}

/* Estilos para los mensajes propios */
.my-message {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px 12px 4px 12px;
    max-width: 75%;
    word-wrap: break-word;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4), inset 0 0 20px rgba(33, 150, 243, 0.1);
    font-size: 0.95rem;
    line-height: 1.4;
    border: 1px solid rgba(33, 150, 243, 0.3);
    position: relative;
}

.my-message::after {
    content: "♠";
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 10px;
    opacity: 0.4;
}

/* Estilos para los mensajes de otros usuarios */
.other-message {
    align-self: flex-start;
    background: var(--brand-dark-3);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 12px 12px 12px 4px;
    max-width: 75%;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.other-message::before {
    content: "♥";
    position: absolute;
    bottom: 5px;
    left: 8px;
    font-size: 10px;
    opacity: 0.3;
    color: var(--poker-heart);
}

/* Mensaje de advertencia */
.warning-message {
    align-self: center;
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    text-align: center;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 10px;
    width: 100%;
    max-width: 90%;
    border: 1px solid rgba(255, 193, 7, 0.3);
    font-size: 0.9rem;
}

/* Ajuste del área de mensajes */
#messages div {
    margin-bottom: 4px;
}

/* Animación de entrada para mensajes */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.my-message,
.other-message {
    animation: messageSlideIn 0.3s ease;
}

/* ===== RESPONSIVE ===== */

/* Tablets */
@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    #register-section,
    #login-section {
        max-width: 100%;
        padding: 24px;
    }

    #register-section h5,
    #login-section h5 {
        font-size: 1.2rem;
    }

    .form-label {
        font-size: 0.85rem;
    }

    .form-control {
        font-size: 0.9rem;
        padding: 10px 14px;
    }

    .btn {
        font-size: 0.9rem;
        padding: 10px 16px;
    }

    #messages {
        height: 60vh;
        max-height: 60vh;
        padding: 12px;
        font-size: 0.9rem;
    }

    .my-message,
    .other-message {
        font-size: 0.9rem;
        padding: 10px 14px;
        max-width: 80%;
    }

    #welcome-section h5 {
        font-size: 0.95rem;
    }
}

/* Móviles */
@media (max-width: 480px) {
    .container {
        padding: 12px 8px;
    }

    #register-section,
    #login-section {
        padding: 20px;
    }

    #register-section h5,
    #login-section h5 {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }

    .form-label {
        font-size: 0.8rem;
    }

    .form-control {
        font-size: 0.85rem;
        padding: 10px 12px;
    }

    .btn {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    #messages {
        height: 55vh;
        max-height: 55vh;
        padding: 12px;
    }

    .my-message,
    .other-message {
        font-size: 0.85rem;
        padding: 10px 12px;
        max-width: 85%;
    }

    #welcome-section {
        padding: 16px;
    }

    #welcome-section h5 {
        font-size: 0.9rem;
    }

    #sendMessage {
        font-size: 0.85rem;
        padding: 10px;
    }

    #charCounter {
        font-size: 0.8rem;
    }
}

/* Modo horizontal en dispositivos móviles */
@media (min-width: 360px) and (max-width: 896px) and (orientation: landscape) {
    #chat-section {
        width: 100%;
        height: 100%;
    }

    #messages {
        height: 60vh;
        max-height: 60vh;
    }

    /* iPhone SE (667x375) */
    @media (max-height: 375px) {
        #messages {
            height: 50vh;
            max-height: 50vh;
        }
    }

    /* Samsung Galaxy S8 (360x740) */
    @media (max-width: 360px) {
        #messages {
            height: 50vh;
            max-height: 50vh;
        }
    }

    /* Surface Duo (720x540) */
    @media (max-height: 540px) {
        #messages {
            height: 55vh;
            max-height: 55vh;
        }
    }
}

/* Pantallas muy pequeñas */
@media (max-width: 360px) {
    .container {
        padding: 10px 6px;
    }

    #register-section,
    #login-section {
        padding: 16px;
    }

    .my-message,
    .other-message {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

/* ===== ESTILOS PARA BOTÓN DE ASISTENCIA PROMINENTE ===== */
#assistance-container-auth {
    position: relative;
    z-index: 10;
}

.assist-button-prominent {
    position: relative;
    animation: pulse-glow 2s ease-in-out infinite;
    transform-style: preserve-3d;
}

.assist-button-prominent::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(33, 150, 243, 0.8) 0%, 
        rgba(100, 181, 246, 0.8) 25%,
        rgba(33, 150, 243, 0.8) 50%,
        rgba(100, 181, 246, 0.8) 75%,
        rgba(33, 150, 243, 0.8) 100%);
    background-size: 300% 300%;
    border-radius: 14px;
    z-index: -1;
    animation: gradient-shift 3s ease infinite;
    opacity: 0.7;
}

.assist-button-prominent::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.assist-button-prominent:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 35px rgba(33, 150, 243, 0.7), 
                0 0 40px rgba(33, 150, 243, 0.5),
                0 0 60px rgba(100, 181, 246, 0.3) !important;
    border-color: rgba(100, 181, 246, 0.8) !important;
}

.assist-button-prominent:hover::after {
    width: 300px;
    height: 300px;
}

.assist-button-prominent:active {
    transform: translateY(-1px) scale(1.01);
}

/* Animación de pulso y brillo */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(33, 150, 243, 0.5), 
                    0 0 30px rgba(33, 150, 243, 0.3),
                    0 0 0 0 rgba(33, 150, 243, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(33, 150, 243, 0.7), 
                    0 0 40px rgba(33, 150, 243, 0.5),
                    0 0 20px 10px rgba(33, 150, 243, 0.2);
    }
}

/* Animación de gradiente en movimiento */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Efecto de brillo intermitente en el texto */
#assist-button-text-auth {
    position: relative;
    display: inline-block;
}

#assist-button-text-auth::before {
    content: '✨';
    position: absolute;
    left: -25px;
    animation: sparkle 1.5s ease-in-out infinite;
    opacity: 0;
}

#assist-button-text-auth::after {
    content: '✨';
    position: absolute;
    right: -25px;
    animation: sparkle 1.5s ease-in-out infinite 0.75s;
    opacity: 0;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Estilo mejorado para el timer */
#assist-timer-auth {
    color: var(--brand-blue-light) !important;
    text-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Efecto cuando el botón está habilitado */
#assistButtonAuth:not([disabled]):not(.disabled) {
    background: linear-gradient(135deg, 
        var(--brand-blue-light) 0%, 
        var(--brand-blue) 50%,
        var(--brand-blue-dark) 100%) !important;
    animation: pulse-glow 2s ease-in-out infinite, 
               gradient-shift 3s ease infinite;
}

/* Efecto cuando el botón está deshabilitado */
#assistButtonAuth[disabled],
#assistButtonAuth.disabled {
    background: linear-gradient(135deg, 
        rgba(100, 100, 100, 0.3) 0%, 
        rgba(70, 70, 70, 0.3) 100%) !important;
    border-color: rgba(100, 100, 100, 0.3) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Responsive para el botón de asistencia */
@media (max-width: 768px) {
    .assist-button-prominent {
        padding: 14px !important;
        font-size: 1rem !important;
    }
    
    #assist-button-text-auth::before,
    #assist-button-text-auth::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .assist-button-prominent {
        padding: 12px !important;
        font-size: 0.95rem !important;
    }
    
    .assist-button-prominent svg {
        width: 20px !important;
        height: 20px !important;
    }
}

