/* auth.css */

/* =======================================
   Authentication Styles (Login/Signup)
   ======================================= */
.auth-page-wrap {
    position: relative;
    width: 75%;
    margin: calc(var(--navbar-height) + var(--sidebar-height) - 35px) auto 0;
}

.auth-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: border-color 0.2s, color 0.2s;
}

.auth-back-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.auth-back-btn svg {
    width: 16px;
    height: 16px;
}

.auth-container {
    position: relative;
    width: 100%;
    margin: 0;
    background-color: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 30px;
    overflow: hidden;
    display: flex;
    height: 660px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.form-panel {
    width: 50%;
    padding: 60px 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.form-panel form {
    width: min(100%, 420px);
}

.overlay-container {
    position: absolute;
    width: 50%;
    height: 100%;
    top: 0;
    left: 50%;
    transition: left 0.6s ease-in-out;
    z-index: 100;
}

.auth-container.signup-mode .overlay-container {
    left: 0;
}

.overlay {
    width: 100%;
    height: 100%;
    background-color: var(--accent-primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 40px;
    box-sizing: border-box;
}

.overlay-panel.overlay-left {
    display: none;
}

.overlay-panel.overlay-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr 50px;
}

.auth-container.signup-mode .overlay-panel.overlay-left {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr 50px;
}

.auth-container.signup-mode .overlay-panel.overlay-right {
    display: none;
}

.overlay-panel h1 {
    margin-bottom: 40px;
    font-size: 1.8em;
}

.input-group {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}

.input-group > svg {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
}

.password-group input {
    padding-right: 50px;
}

/* Keep Edge's native password controls from appearing beside our custom eye. */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--accent-primary);
}

.password-toggle svg {
    position: static;
    transform: none;
    width: 20px;
    height: 20px;
    color: inherit;
}

.password-toggle .icon-on {
    display: none;
}

.password-toggle:hover .icon-off {
    display: none;
}

.password-toggle:hover .icon-on {
    display: block;
}

.password-toggle.is-visible .icon-on {
    display: block;
}

.password-toggle.is-visible .icon-off {
    display: none;
}

.password-toggle.is-visible:hover .icon-on {
    display: none;
}

.password-toggle.is-visible:hover .icon-off {
    display: block;
}

.input-group input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-sizing: border-box;
    font-size: 1em;
}

.phone-input-group .phone-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    overflow: hidden;
}

.phone-input-group .phone-group > svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    pointer-events: none;
}

.phone-input-group .phone-code {
    flex: 0 0 132px;
    width: 132px;
    min-width: 0;
    text-align: center;
    border-radius: 25px 0 0 25px !important;
    padding-left: 40px;
    padding-right: 10px;
}

.phone-input-group .phone-number {
    flex: 1;
    min-width: 0;
    border-radius: 0 25px 25px 0 !important;
    border-left: none !important;
}

.phone-input-group .phone-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-sizing: border-box;
    font-size: 1em;
}

.phone-input-group .phone-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.signin-invalid {
    border-color: #dc2626 !important;
    animation: auth-shake 0.32s ease-in-out;
}

.auth-forgot-password {
    display: block;
    width: auto;
    margin: -6px auto 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-primary);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.auth-forgot-password:hover { text-decoration: underline; }

.auth-resend-verification {
    position: relative;
    z-index: 2;
    margin: 14px auto 0;
    padding: 2px 8px;
    line-height: 1.4;
}

.auth-message {
    min-height: 1.25em;
    margin: 10px 0 0;
    color: #dc2626;
    font-size: 0.86rem;
    font-weight: 500;
    text-align: center;
}

.auth-message.success { color: #168a62; }

@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.terms {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.auth-terms-consent {
    margin: 12px 0 16px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
}

.auth-terms-consent a {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
    .auth-container {
        background-color: var(--bg-secondary);
    }

    .input-group input {
        background-color: var(--bg-primary);
        border-color: var(--border-color);
    }

    .phone-input-group .phone-group input {
        background-color: var(--bg-primary);
        border-color: var(--border-color);
    }
}

/* =======================================
   Responsive: Auth page
   On narrow screens the sliding two-panel card stacks vertically:
   the active form on top, the teal switch strip below.
   ======================================= */
@media (max-width: 900px) {
    .auth-page-wrap {
        width: 90%;
    }

    .auth-container {
        flex-direction: column;
        height: auto;
        min-height: 740px;
    }

    .form-panel {
        width: 100%;
        padding: 40px 28px;
        height: auto;
        flex: 1;
    }

    /* Show only the active form */
    .auth-container:not(.signup-mode) .sign-up-panel,
    .auth-container.signup-mode .sign-in-panel {
        display: none;
    }

    .overlay-container {
        position: static;
        width: 100%;
        height: auto;
        left: auto;
        flex: 0 0 auto;
    }

    .overlay {
        padding: 24px;
    }

    .overlay-panel.overlay-right,
    .auth-container.signup-mode .overlay-panel.overlay-left {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 10px;
    }

    .overlay-panel h1 {
        margin-bottom: 16px;
        font-size: 1.4em;
    }

    /* Transition when switching between Sign in / Sign up: the active
       form slides in from its side, the teal switch strip fades in. */
    .auth-container:not(.signup-mode) .sign-in-panel {
        animation: authFormLeft 0.45s ease;
    }
    .auth-container.signup-mode .sign-up-panel {
        animation: authFormRight 0.45s ease;
    }
    .overlay-panel.overlay-right,
    .auth-container.signup-mode .overlay-panel.overlay-left {
        animation: authOverlayIn 0.45s ease;
    }
}

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

@keyframes authFormRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes authOverlayIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .auth-page-wrap {
        width: 94%;
    }

    .auth-container {
        min-height: 700px;
    }

    .form-panel {
        padding: 30px 18px;
    }

    .input-group input {
        padding: 13px 13px 13px 44px;
        font-size: 0.95em;
    }

    .phone-input-group .phone-group input {
        padding: 13px;
        font-size: 0.95em;
    }

    .auth-back-btn {
        padding: 8px 18px;
        font-size: 0.85rem;
    }
}
