/* ================================================
   LOGIN & TWO-FACTOR AUTHENTICATION STYLES
   100% Responsive - CSP Compliant (No inline styles)
   ================================================ */

/* ===== BODY BACKGROUND FOR AUTH PAGES ===== */
body.log-page {
    background-color: #080c11;
    background-image:
        radial-gradient(100% 130% at 50% 50%, rgba(0,0,0,0) 40%, rgba(0,0,0,.35) 100%),
        radial-gradient(60% 60% at 78% 26%, rgba(26,188,156,.12) 0%, rgba(26,188,156,0) 60%),
        radial-gradient(55% 55% at 25% 75%, rgba(64,156,255,.08) 0%, rgba(64,156,255,0) 60%);
    background-blend-mode: soft-light, normal, normal;
    background-size: cover, cover, cover;
    background-position: center, center, center;
    background-attachment: fixed;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== DEFAULT CONTAINER (for non-focus pages) ===== */
.log-default-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
}

/* ===== WATERMARK LOGO ===== */
.log-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    opacity: 0.008;
    width: 120vw;
    max-width: 1600px;
}

.log-watermark img {
    width: 100%;
    height: auto;
    filter: grayscale(100%);
}

/* ===== MAIN CONTAINER ===== */
.log-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

/* Allow scroll when content is taller than viewport */
@supports (-webkit-overflow-scrolling: touch) {
    .log-container {
        align-items: flex-start;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

.log-card-wrapper {
    max-width: 500px;
    width: 100%;
    margin: auto 0;
}

/* ===== LOGO & BRAND SECTION ===== */
.log-logo-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.log-logo-container {
    display: inline-block;
    margin-bottom: 1rem;
}

.log-logo {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.25));
}

.log-brand-title {
    background: linear-gradient(135deg, #39FF14, #00FFA3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.3px;
}

/* ===== HEADER SECTION ===== */
.log-header {
    margin-bottom: 1.5rem;
}

/* ===== DIVIDER ===== */
.log-divider {
    margin: 1rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* ===== ADDITIONAL LINKS SECTION ===== */
.log-links-section {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.log-forgot-password {
    text-align: center;
    text-decoration: none;
    transition: color 0.2s;
}

.log-forgot-password svg {
    margin-right: 0.25rem;
}

.log-register-card {
    padding: 0.75rem;
    text-align: center;
}

/* ===== BUTTON STYLES ===== */
.log-btn-full {
    width: 100%;
}

.log-btn-icon {
    margin-right: 0.25rem;
}

.log-btn-group {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 0.75rem;
    align-items: center;
}

.log-btn-group .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== HELP SECTION ===== */
.log-help {
    text-align: center;
    margin-top: 1.5rem;
}

/* ===== FOOTER STYLES ===== */
/* Header para páginas de autenticación */
.log-page .header {
    position: relative;
    z-index: 100;
}

/* Footer para páginas de autenticación */
.log-page .footer {
    background: transparent;
    border-top: 1px solid rgba(34, 197, 94, 0.08);
    padding: 1rem 1.5rem;
    margin-top: auto;
}

.log-page .footer-container {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
}

.log-page .footer-copy {
    color: var(--secondary);
    margin: 0;
}

.log-page .footer-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.log-page .footer-links a {
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.log-page .footer-links a:hover {
    color: var(--success);
}

/* ===== SECURITY INFO BADGES ===== */
.log-security-badge {
    padding: 0.75rem;
}

.log-error-card {
    padding: 0.5rem;
    margin-bottom: 0.25rem;
}

/* ===== ICON SIZES ===== */
.log-icon-xl {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
}

.log-icon-lg {
    width: 32px;
    height: 32px;
}

.log-icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(34, 197, 94, 0.2);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
}

.log-icon-badge-danger {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    margin: 0 auto 1rem;
}

.log-icon-badge-success {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
    margin: 0 auto 1rem;
}

/* ===== CARD VARIANTS ===== */
.log-card-max-800 {
    max-width: 800px;
    margin: 0 auto;
}

.log-card-padding {
    padding: 1rem;
}

.log-card-padding-sm {
    padding: 0.75rem;
}

.log-card-spacing-bottom {
    margin-bottom: 0.25rem;
}

/* ===== TEXT UTILITIES ===== */
.log-mb-sm {
    margin-bottom: 0.25rem;
}

/* ===== FULL WIDTH UTILITIES ===== */
.log-w-full {
    width: 100%;
}

/* ===== QR CODE STYLES ===== */
.log-qr-container {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    display: inline-block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.log-qr-image {
    max-width: 200px;
    display: block;
}

.log-secret-container {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 6px;
}

.log-secret-code {
    font-family: monospace;
    letter-spacing: 0.05em;
}

.log-token-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: monospace;
}

.log-token-badge {
    font-family: monospace;
    font-size: 0.875rem;
}

.log-nowrap {
    white-space: nowrap;
}

.log-flex-between {
    justify-content: space-between;
}

/* ===== 2FA SETUP INTRO STYLES ===== */
.log-2fa-intro {
    text-align: center;
    margin-bottom: 2rem;
}

.log-2fa-intro .log-icon-badge-danger {
    margin: 0 auto 1.5rem;
}

.log-2fa-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.log-2fa-step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.log-2fa-step-active {
    background: linear-gradient(135deg, #22c55e, #00FFA3);
    color: #080c11;
}

.log-2fa-step-inactive {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid rgba(34, 197, 94, 0.3);
    color: #9aa4b2;
}

.log-2fa-step-line {
    width: 60px;
    height: 2px;
    background: rgba(34, 197, 94, 0.3);
}

.log-2fa-benefits {
    margin-bottom: 2rem;
}

.log-2fa-benefits h3 {
    text-align: center;
}

.log-2fa-benefit-card {
    padding: 1rem;
}

.log-2fa-benefit-card .log-icon-badge {
    flex-shrink: 0;
}

/* ===== 2FA METHOD SELECTION STYLES ===== */
.log-method-selector {
    margin-bottom: 1.5rem;
}

.log-method-card {
    position: relative;
    padding: 1.25rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

.log-method-card input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.log-hidden-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.log-method-content {
    position: relative;
    padding-left: 40px;
}

/* Estilos cuando el radio real está checked - solo el indicador */
.log-method-card:has(input[type="radio"]:checked) .log-method-indicator {
    display: block;
}


.log-method-indicator {
    display: none;
    position: absolute;
    top: 3rem;
    left: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #00FFA3);
}

.log-method-indicator::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #080c11;
    font-weight: 700;
    font-size: 14px;
}

.log-method-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.log-method-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.log-method-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.log-method-badge-recommended {
    background: rgba(34, 197, 94, 0.2);
    color: #00FFA3;
}

.log-method-badge-alternative {
    background: rgba(100, 116, 139, 0.2);
    color: #9aa4b2;
}

.log-method-description {
    margin-bottom: 0.75rem;
}

.log-method-features {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.log-method-feature {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
}

.log-method-feature svg {
    flex-shrink: 0;
}

.log-method-title-wrapper {
    flex: 1;
}

.log-method-security-tip {
    padding: 0.75rem;
}

.log-method-security-tip svg {
    flex-shrink: 0;
}

/* ===== REGISTER PAGE SPECIFIC STYLES ===== */
.log-reg-form {
    width: 100%;
}

.log-reg-input {
    background: rgba(20, 24, 33, 0.4);
    border: 1px solid rgba(57, 255, 20, 0.3);
    border-radius: 0.75rem;
    padding: 0.75rem;
    color: #e8f0ff;
    width: 100%;
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.log-reg-input:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #00FFA3;
    border-color: rgba(57, 255, 20, 0.5);
}

.log-reg-input::placeholder {
    color: #9aa4b2;
}

.log-reg-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #e8f0ff;
}

.log-reg-help {
    font-size: 0.75rem;
    color: #9aa4b2;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.log-reg-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.log-reg-required {
    color: #ef4444;
}

.log-reg-signin-card {
    padding: 0.75rem;
    text-align: center;
}

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

/* Custom Checkbox */
.log-custom-checkbox {
    display: flex;
    align-items: flex-start;
    position: relative;
    padding-left: 2.25rem;
    cursor: pointer;
    user-select: none;
    min-height: 1.5rem;
}

.log-custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 0;
    height: 0;
}

.log-checkbox-checkmark {
    position: absolute;
    top: 0.125rem;
    left: 0;
    height: 1.25rem;
    width: 1.25rem;
    background-color: rgba(20, 24, 33, 0.6);
    border: 2px solid rgba(57, 255, 20, 0.3);
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.log-custom-checkbox:hover .log-checkbox-checkmark {
    border-color: rgba(57, 255, 20, 0.5);
    background-color: rgba(20, 24, 33, 0.8);
}

.log-custom-checkbox input[type="checkbox"]:checked ~ .log-checkbox-checkmark {
    background: linear-gradient(135deg, #22c55e, #00FFA3);
    border-color: #22c55e;
}

.log-checkbox-checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #080c11;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.log-custom-checkbox input[type="checkbox"]:checked ~ .log-checkbox-checkmark::after {
    display: block;
}

.log-checkbox-label {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    line-height: 1.3;
}

/* Tablets (768px and below) */
@media (max-width: 768px) {
    .log-container {
        padding: 1.5rem 1rem;
    }

    .log-card-wrapper {
        max-width: 100%;
    }

    .log-logo {
        height: 70px;
    }

    .log-watermark {
        width: 140vw;
        max-width: 1400px;
    }
}

/* Mobile devices (480px and below) */
@media (max-width: 480px) {
    .log-container {
        padding: 1rem 0.75rem;
        align-items: flex-start;
    }

    .log-card-wrapper {
        margin: 0;
    }

    .log-logo {
        height: 60px;
    }

    .log-logo-section {
        margin-bottom: 1rem;
    }

    .log-logo-container {
        margin-bottom: 0.75rem;
    }

    .log-header {
        margin-bottom: 1rem;
    }

    .log-divider {
        margin: 0.75rem 0;
    }

    .log-links-section {
        margin-top: 1rem;
        gap: 0.5rem;
    }

    .log-register-card,
    .log-reg-signin-card {
        padding: 0.5rem;
    }

    /* Reduce card padding on mobile - ONLY for auth pages */
    .log-container .card {
        padding: 1.25rem;
    }

    /* Register form mobile adjustments */
    .log-reg-input {
        padding: 0.625rem;
        font-size: 0.875rem;
    }

    .log-reg-label {
        font-size: 0.8125rem;
    }

    /* Reduce spacing for register form */
    .mb-3 {
        margin-bottom: 0.75rem;
    }

    /* Button group stack on mobile */
    .log-btn-group {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* 2FA intro responsive */
    .log-2fa-intro {
        margin-bottom: 1.5rem;
    }

    .log-2fa-steps {
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .log-2fa-step {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .log-2fa-step-line {
        width: 40px;
    }

    .log-2fa-benefits {
        margin-bottom: 1.5rem;
    }

    .log-2fa-benefit-card {
        padding: 0.75rem;
    }

    /* Method selector responsive */
    .log-method-card {
        padding: 1rem;
    }

    .log-method-icon {
        width: 36px;
        height: 36px;
    }

    .log-method-header {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* Footer responsive */
    .log-page .footer {
        padding: 1rem;
    }

    .log-page .footer-container {
        gap: 0.5rem;
    }

    .log-page .footer-links {
        gap: 1rem;
        flex-wrap: wrap;
    }
}

/* Extra small devices (360px and below) */
@media (max-width: 360px) {
    .log-container {
        padding: 0.75rem 0.5rem;
    }

    .log-logo {
        height: 50px;
    }

    .log-watermark {
        width: 160vw;
    }

    .log-container .card {
        padding: 1rem;
    }

    .log-links-section {
        gap: 0.5rem;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .log-container {
        padding: 1rem;
        align-items: flex-start;
    }

    .log-card-wrapper {
        margin: 0;
    }

    .log-logo {
        height: 50px;
    }

    .log-logo-section {
        margin-bottom: 0.75rem;
    }

    .log-header {
        margin-bottom: 0.75rem;
    }

    .mb-3 {
        margin-bottom: 0.5rem;
    }
}

/* Pantallas muy cortas - forzar scroll */
@media (max-height: 700px) {
    .log-container {
        align-items: flex-start;
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .log-card-wrapper {
        margin: 0 auto;
    }
}

/* Aplicar estilos a inputs generados por Django */
.mb-3 input[type="text"],
.mb-3 input[type="password"],
.mb-3 input[type="email"],
.mb-3 input[type="number"],
.mb-3 input[type="tel"],
.mb-3 select,
.mb-3 textarea {
  background: rgba(20, 24, 33, 0.4);
  border: 1px solid rgba(57, 255, 20, 0.3);
  border-radius: 0.75rem;
  padding: 0.75rem;
  color: #e8f0ff;
  width: 100%;
  font-family: inherit;
  font-size: 0.875rem;
}

.mb-3 input[type="text"]:focus,
.mb-3 input[type="password"]:focus,
.mb-3 input[type="email"]:focus,
.mb-3 input[type="number"]:focus,
.mb-3 input[type="tel"]:focus,
.mb-3 select:focus,
.mb-3 textarea:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #00FFA3;
  border-color: rgba(57, 255, 20, 0.5);
}

.mb-3 input::placeholder,
.mb-3 textarea::placeholder {
  color: #9aa4b2;
}

.mb-3 select {
  cursor: pointer;
}

.mb-3 input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
}