/* Authentication Styles */
:root {
    /* Adding auth-specific variables */
    --auth-bg-opacity: 0.1;
    --auth-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --auth-border: 1px solid rgba(255, 255, 255, 0.1);
    --auth-transition: all 0.3s ease;
}

.dark-mode {
    --auth-bg-opacity: 0.15;
    --auth-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --auth-border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Auth Page */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-image: url('/static/images/login/background_login_1440.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
    z-index: 0;
}

.auth-container {
    position: relative;
    z-index: 1;
    max-width: 460px;
    width: 100%;
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background-color: rgba(255, 255, 255, var(--auth-bg-opacity));
    border: var(--auth-border);
    text-align: center;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(120deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

.auth-title {
    color: var(--light-text);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form label {
    display: block;
    color: var(--light-text);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* ──────────────────────────────────────────────
   General form inputs — explicitly excludes
   captcha cells and honeypot trap fields so
   their dedicated sizing is never overridden.
   ────────────────────────────────────────────── */
.auth-form input:not(.captcha-input):not(.hp-field) {
    width: 100%;
    padding: 12px 15px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    color: var(--light-text);
    font-size: 1rem;
    transition: var(--auth-transition);
}

.auth-form input:not(.captcha-input):not(.hp-field):focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.auth-form input:not(.captcha-input):not(.hp-field)::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* ──────────────────────────────────────────────
   CAPTCHA — container, image, individual cells.

   FIX C-3: Removed col-8 constraint from HTML.
   Image and inputs container widths are now
   controlled entirely via CSS for responsive
   scaling. Touch targets sized to ≥36px on all
   breakpoints.
   ────────────────────────────────────────────── */
.auth-form .captcha-container {
    align-items: center;
    width: 100%;
    margin: auto;
    gap: 1rem;
    margin-top: 1rem;
}

.auth-form .captcha-image {
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    padding: 0.5rem;
    max-width: 320px;
    width: 80%;
    background-color: rgba(0, 0, 0, 0.5);
}

.auth-form .captcha-inputs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.4rem;
    width: 80%;
    max-width: 100%;
}

.auth-form .captcha-input {
    width: 2.6rem;
    min-width: 2.6rem;
    max-width: 2.6rem;
    height: 2.8rem;
    padding: 0;
    margin: 0;
    text-align: center;
    vertical-align: middle;
    font-size: 1.2rem;
    line-height: 2.8rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light-text);
    transition: border-color 0.3s ease, background-color 0.3s ease;
    box-sizing: border-box;
}

.auth-form .captcha-input:focus {
    border-color: rgba(255, 215, 0, 0.6);
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
    outline: none;
}

/* ──────────────────────────────────────────────
   Captcha image wrapper — positions the refresh
   button overlay relative to the captcha image.
   ────────────────────────────────────────────── */
.auth-form .captcha-image-wrap {
    position: relative;
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 280px;
}

.auth-form .captcha-image-wrap .captcha-image {
    width: 100%;
    max-width: none;
    margin: 0;
}

.auth-form .captcha-refresh-btn {
 
    margin:  1em auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.8s ease, transform 0.8s ease;
    padding: 0;
    line-height: 1;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

.auth-form .captcha-refresh-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
}

.auth-form .captcha-refresh-btn:active {
    transform: scale(0.9);
}

.auth-form .captcha-refresh-btn.captcha-spinning {
    animation: captcha-spin 0.6s linear;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes captcha-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ──────────────────────────────────────────────
   Honeypot trap wrappers — truly invisible in
   any rendering engine, yet present in the DOM
   tree for automated scrapers / form-fillers.
   ────────────────────────────────────────────── */
.auth-form .hp-wrap {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0.01;
}

.auth-form .hp-wrap .hp-field {
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: transparent;
    font-size: 0;
}

.auth-message {
    color: var(--light-text);
    font-size: 0.9rem;
    text-align: center;
    min-height: 20px;
    margin-bottom: 1rem;
}

.auth-actions {
    text-align: center;
    margin-top: 2rem;
}

.auth-actions .btn {
    min-width: 150px;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.auth-links a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--auth-transition);
}

.auth-links a:hover {
    color: var(--light-text);
    text-decoration: underline;
}

/* Cookie Consent */
.cookie-consent {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    background-color: rgba(26, 41, 48, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    z-index: 9999;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
    transition: bottom 0.5s ease;
}

.cookie-consent.active {
    bottom: 0;
}

.cookie-content {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.cookie-text {
    flex: 1;
    min-width: 300px;
}

.cookie-text h3 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.cookie-text p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
}

/* Cookie Modal */
.cookie-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cookie-modal.active {
    opacity: 1;
    visibility: visible;
}

.cookie-modal-content {
    max-width: 600px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.cookie-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cookie-modal-header h3 {
    color: var(--light-text);
    margin: 0;
    font-size: 1.5rem;
}

.cookie-close {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.3s ease;
}

.cookie-close:hover {
    color: var(--primary-color);
}

.cookie-modal-body {
    padding: 1.5rem;
}

.cookie-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cookie-option:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cookie-option h4 {
    color: var(--light-text);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.cookie-option p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    max-width: 400px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    flex-shrink: 0;
}

.switch.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.cookie-modal-footer {
    padding: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ══════════════════════════════════════════════════════
   Responsive — Tablet (≤768px)
   FIX C-3: Captcha inputs sized for comfortable touch
   targets. Image and inputs use wider percentage to
   maximize usable space.
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .auth-container {
        padding: 2rem;
    }

    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }

    .auth-form .captcha-image {
        width: 90%;
        max-width: 300px;
    }

    .auth-form .captcha-inputs {
        width: 90%;
    }

    .auth-form .captcha-input {
        width: 2.5rem;
        min-width: 2.5rem;
        max-width: 2.5rem;
        height: 2.8rem;
        font-size: 1.1rem;
        line-height: 2.8rem;
    }
}

/* ══════════════════════════════════════════════════════
   Responsive — Small phone (≤576px)
   FIX C-3: Full-width captcha container, flex-wrap
   enabled for 7+ digit captchas on narrow viewports.
   Minimum 36px touch target preserved.
   ══════════════════════════════════════════════════════ */
@media (max-width: 576px) {
    .auth-container {
        padding: 1.5rem;
    }

    .auth-title {
        font-size: 1.75rem;
    }

    .auth-subtitle {
        font-size: 1rem;
    }

    .cookie-option {
        flex-direction: column;
        align-items: flex-start;
    }

    .cookie-option .switch {
        margin-top: 1rem;
    }

    .auth-form .captcha-image {
        width: 100%;
        max-width: 280px;
    }

    .auth-form .captcha-inputs {
        width: 100%;
        gap: 0.3rem;
        flex-wrap: wrap;
    }

    .auth-form .captcha-input {
        width: 2.6rem;
        min-width: 2.6rem;
        max-width: 2.6rem;
        height: 2.8rem;
        font-size: 1.1rem;
        line-height: 2.8rem;
    }
}

/* ══════════════════════════════════════════════════════
   Responsive — Very small phone (≤400px)
   FIX C-3: At 320px viewport with 7 digits, inputs
   need flex-wrap + slightly reduced size to fit.
   2.3rem ≈ 32px at 14px base — just above minimum.
   ══════════════════════════════════════════════════════ */
@media (max-width: 400px) {
    .auth-form .captcha-inputs {
        width: 100%;
        gap: 0.25rem;
        flex-wrap: wrap;
    }

    .auth-form .captcha-input {
        width: 2.3rem;
        min-width: 2.3rem;
        max-width: 2.3rem;
        height: 2.6rem;
        font-size: 1rem;
        line-height: 2.6rem;
    }
}

.auth-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    color: var(--light-text);
    font-size: 1rem;
    transition: var(--auth-transition);
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.auth-form textarea:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.checkbox-group {
    margin-top: 1.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    color: var(--light-text);
    font-size: 0.95rem;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    transition: var(--auth-transition);
}

.checkbox-container:hover input ~ .checkmark {
    background-color: rgba(255, 255, 255, 0.2);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    line-height: 1.5;
}

.checkbox-text a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: var(--auth-transition);
}

.checkbox-text a:hover {
    color: white;
}