/* ==========================================
   HAT-TRICK - ESTILOS DE AUTENTICACIÓN
   Login / Registro / Auth
   ========================================== */

:root {
    --red: #E30613;
    --red-dark: #B8050F;
    --black: #0A0A0A;
    --dark: #1A1A1A;
    --white: #FFFFFF;
    --gray: #F5F5F5;
    --gray-light: #E0E0E0;
    --gray-text: #888888;
    --success: #27AE60;
    --error: #E74C3C;
    --info: #3498DB;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================
   AUTH TOPBAR NAVBAR
   ========================================== */

.auth-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: linear-gradient(135deg, #E30613 0%, #c0050f 50%, #E30613 100%);
    z-index: 100;
}

.auth-topbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
    pointer-events: none;
}

.auth-topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
}

.auth-topbar-logo img {
    height: 34px;
    width: auto;
    transition: all 0.3s ease;
}

.auth-topbar-logo:hover img {
    transform: scale(1.06);
}

.auth-topbar-back {
    color: #fff;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
}

.auth-topbar-back:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(-3px);
    border-color: rgba(255,255,255,0.4);
}

body {
    font-family: 'Inter', sans-serif;
    background: #0A0A0A;
    color: var(--white);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   CONTENEDOR PRINCIPAL
   ========================================== */

.auth-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 74px 20px 20px;
    position: relative;
    background: #0A0A0A;
    background: linear-gradient(
        135deg,
        #0A0A0A 25%,
        #141414 25%,
        #141414 50%,
        #0A0A0A 50%,
        #0A0A0A 75%,
        #141414 75%,
        #141414
    );
    background-size: 40px 40px;
    animation: bgMove 4s linear infinite;
}

@keyframes bgMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

.auth-card {
    background: #161616;
    border-radius: 14px;
    padding: 36px 40px;
    width: 100%;
    max-width: 480px;
    border-top: 3px solid var(--red);
    position: relative;
    z-index: 1;
    /* 3D Style */
    perspective: 1000px;
    transform-style: preserve-3d;
    overflow: hidden;
    animation: form3D 0.6s ease-in-out;
}

/* Card más ancho para registro */
.auth-card:has(.auth-form-compact),
.auth-card.auth-card-registro {
    max-width: 540px;
    padding: 28px 34px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes form3D {
    from {
        transform: rotateX(-30deg);
        opacity: 0;
    }
    to {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

/* ==========================================
   LOGO
   ========================================== */

.auth-logo {
    text-align: center;
    margin-bottom: 18px;
}

.auth-logo a {
    text-decoration: none;
    display: inline-block;
}

.logo-img {
    height: 50px;
    width: auto;
    background: transparent;
    padding: 0;
    border-radius: 0;
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
}

/* ==========================================
   TÍTULOS
   ========================================== */

.auth-title {
    font-size: 1.3rem;
    font-weight: 900;
    text-align: center;
    letter-spacing: 3px;
    color: var(--white);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 0.78rem;
    text-align: center;
    color: #666;
    margin-bottom: 18px;
    font-weight: 400;
}

/* ==========================================
   ALERTAS
   ========================================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.alert-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert ul li {
    margin-bottom: 2px;
}

.alert ul li:last-child {
    margin-bottom: 0;
}

.alert-error {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.25);
    color: #c0392b;
}

.alert-success {
    background: rgba(39, 174, 96, 0.08);
    border: 1px solid rgba(39, 174, 96, 0.25);
    color: #1e8449;
}

.alert-success a {
    color: var(--success);
    font-weight: 600;
    text-decoration: underline;
}

.alert-info {
    background: rgba(52, 152, 219, 0.08);
    border: 1px solid rgba(52, 152, 219, 0.25);
    color: #2471a3;
}

/* ==========================================
   FORMULARIO
   ========================================== */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-compact {
    gap: 10px;
}

/* Filas de 2 columnas */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-card:has(.auth-form-compact),
    .auth-card.auth-card-registro {
        max-width: 440px;
        padding: 28px 20px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.form-group label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: 2px solid var(--red);
    border-radius: 6px;
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    outline: none;
    transform-style: preserve-3d;
    transition: border-color 0.3s ease-in-out, background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.form-group input:hover,
.form-group input:focus {
    border-color: #ff1a2e;
    background-color: rgba(227, 6, 19, 0.05);
    transform: scale(1.03) rotateY(8deg);
}

.form-group input::placeholder {
    color: #888;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-text);
    margin-top: 2px;
}

.optional {
    font-weight: 400;
    color: #aaa;
    text-transform: none;
    letter-spacing: 0;
}

/* ==========================================
   CONTRASEÑA CON TOGGLE
   ========================================== */

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 0.7;
}

/* ==========================================
   OPCIONES DEL FORM
   ========================================== */

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--gray-text);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--red);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.forgot-link {
    color: var(--red);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.forgot-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ==========================================
   BOTÓN PRINCIPAL
   ========================================== */

.btn-auth {
    width: 100%;
    padding: 13px;
    background: var(--red);
    color: var(--white);
    border: 2px solid var(--red);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    margin-top: 4px;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transform: rotateX(-5deg);
    transition: all 0.3s ease-in-out;
}

.btn-auth:hover {
    background: var(--red);
    font-size: 0.92rem;
    transform: scale(1.05) rotateY(8deg) rotateX(5deg);
}

.btn-auth:active {
    transform: scale(0.98) rotateX(0deg);
}

/* ==========================================
   FOOTER
   ========================================== */

.auth-footer {
    text-align: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #2A2A2A;
}

.auth-footer p {
    font-size: 0.78rem;
    color: #666;
    margin-bottom: 4px;
}

.auth-footer a {
    color: var(--red);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.auth-footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.back-link {
    font-size: 0.8rem;
    color: #555 !important;
    font-weight: 400 !important;
}

.back-link:hover {
    color: #ccc !important;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 12px;
    }

    .auth-title {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }

    .logo-img {
        height: 50px;
    }
}

/* ==========================================
   ERRORES POR CAMPO
   ========================================== */

.field-error {
    font-size: 0.75rem;
    color: var(--error);
    min-height: 0;
    transition: all 0.2s ease;
}

.field-error:not(:empty) {
    margin-top: 4px;
}

.input-error {
    border-color: var(--error) !important;
}

/* ==========================================
   SPINNER / LOADING
   ========================================== */

.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.spinner {
    width: 20px;
    height: 20px;
}

.btn-auth:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* ==========================================
   SHAKE ANIMATION
   ========================================== */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ==========================================
   PASSWORD STRENGTH INDICATOR
   ========================================== */

.password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.strength-bar {
    flex: 1;
    height: 3px;
    background: #2A2A2A;
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-text {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 70px;
    text-align: right;
}

/* ==========================================
   VISTA DE ÉXITO
   ========================================== */

.success-view {
    text-align: center;
    padding: 20px 0;
}

.success-icon-big {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(39, 174, 96, 0.15);
    color: var(--success);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border: 2px solid var(--success);
    animation: fadeInUp 0.5s ease-out;
}

.success-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 8px;
}

.success-text {
    font-size: 0.9rem;
    color: var(--gray-text);
    line-height: 1.6;
}

/* ==========================================
   DIVIDER
   ========================================== */

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #2A2A2A;
}

.auth-divider span {
    font-size: 0.8rem;
    color: var(--gray-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==========================================
   BOTÓN WHATSAPP
   ========================================== */

.btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: rgba(37, 211, 102, 0.1);
    border: 2px solid rgba(37, 211, 102, 0.4);
    border-radius: 6px;
    color: #25D366;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transform: rotateX(-5deg);
    transition: all 0.3s ease-in-out;
}

.btn-whatsapp:hover {
    background: rgba(37, 211, 102, 0.2);
    transform: scale(1.05) rotateY(8deg) rotateX(5deg);
}

/* ==========================================
   LINK ACCENT
   ========================================== */

.link-accent {
    color: var(--red);
    text-decoration: none;
    font-weight: 600;
}

.link-accent:hover {
    text-decoration: underline;
}

/* ==========================================
   SELECT (ROL)
   ========================================== */

.form-select {
    width: 100%;
    padding: 8px 12px;
    background: #1E1E1E;
    border: 1px solid #333;
    border-radius: 8px;
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    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='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.form-select:focus {
    border-color: var(--red);
}

.form-select option {
    background: #1E1E1E;
    color: var(--white);
}

/* ==========================================
   ROLE SELECTOR BUTTONS
   ========================================== */

.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 10px;
    background: #1E1E1E;
    border: 2px solid #2A2A2A;
    border-radius: 10px;
    color: #666;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.role-btn:hover {
    border-color: #555;
    color: #bbb;
    background: #252525;
}

.role-btn.active {
    background: rgba(227, 6, 19, 0.08);
    border-color: var(--red);
    color: #fff;
}

.role-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #252525;
    transition: all 0.3s ease;
}

.role-btn.active .role-icon {
    background: rgba(227, 6, 19, 0.15);
}

.role-icon svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
}

.role-btn:not(.active) .role-icon svg {
    stroke: #777;
}

.role-btn.active .role-icon svg {
    stroke: var(--red);
}

.role-label {
    font-size: 0.82rem;
    letter-spacing: 0.5px;
}

/* ==========================================
   EYE ICON (SVG toggle)
   ========================================== */

.eye-icon {
    width: 18px;
    height: 18px;
}

.toggle-password.active .eye-icon {
    opacity: 0.5;
}

/* ==========================================
   USER GREETING (admin header)
   ========================================== */

.user-greeting {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
    white-space: nowrap;
}
