/* ============================================
   AUTH MODAL — Login & Sign Up
   ============================================ */

/* ========== MODAL WRAPPER ========== */
.st-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.st-auth-modal[hidden] {
    display: none;
}

/* ========== BACKDROP ========== */
.st-auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

/* ========== BOX ========== */
.st-auth-modal__box {
    position: relative;
    z-index: 1;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 40px 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    animation: st-modal-in 0.25s ease;
}

@keyframes st-modal-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== CLOSE BUTTON ========== */
.st-auth-modal__close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--color-gray-600);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

.st-auth-modal__close:hover {
    color: var(--color-black);
    background: var(--color-gray-100);
}

/* ========== CONTEXT HINT (set when modal is triggered by product actions) ========== */
.st-auth-context-msg {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 0.88rem;
    font-family: var(--font-body);
    text-align: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    line-height: 1.5;
}

.st-auth-context-msg[hidden] {
    display: none;
}

/* ========== TABS ========== */
.st-auth-modal__tabs {
    display: flex;
    gap: 0;
    background: var(--color-gray-100);
    border-radius: var(--radius-full);
    padding: 4px;
    margin-bottom: 28px;
}

.st-auth-tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.st-auth-tab.is-active {
    background: var(--color-white);
    color: var(--color-black);
    box-shadow: var(--shadow-sm);
}

.st-auth-tab:hover:not(.is-active) {
    color: var(--color-black);
}

/* ========== TITLE ========== */
.st-auth-modal__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--color-black);
    margin-bottom: 24px;
    text-align: center;
}

/* ========== FORM FIELDS ========== */
.st-auth-field {
    margin-bottom: 16px;
}

.st-auth-field label {
    display: block;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-black);
    margin-bottom: 6px;
}

.st-auth-field input[type="text"],
.st-auth-field input[type="email"],
.st-auth-field input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-black);
    background: var(--color-white);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.st-auth-field input:focus {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px rgba(235, 31, 58, 0.12);
}

/* Password wrapper */
.st-auth-field__pass-wrap {
    position: relative;
}

.st-auth-field__pass-wrap input[type="password"],
.st-auth-field__pass-wrap input[type="text"] {
    padding-right: 44px;
}

.st-pass-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-gray-600);
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.st-pass-toggle:hover {
    color: var(--color-black);
}

.st-eye-icon {
    width: 18px;
    height: 18px;
}

/* ========== ERROR MESSAGE ========== */
.st-auth-error {
    background: #fff0f2;
    border: 1px solid rgba(235, 31, 58, 0.3);
    color: var(--color-red-dark);
    font-size: 0.85rem;
    font-family: var(--font-body);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
}

.st-auth-error[hidden] {
    display: none;
}

/* ========== SUBMIT BUTTON ========== */
.st-auth-submit {
    width: 100%;
    padding: 13px 24px;
    background: var(--color-red);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.st-auth-submit:hover:not(:disabled) {
    background: var(--color-red-dark);
    transform: translateY(-1px);
}

.st-auth-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
.st-auth-submit__spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: st-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.st-auth-submit__spinner[hidden] {
    display: none;
}

@keyframes st-spin {
    to { transform: rotate(360deg); }
}

/* ========== SWITCH LINK ========== */
.st-auth-modal__switch {
    text-align: center;
    font-size: 0.88rem;
    color: var(--color-gray-600);
    margin-top: 20px;
    font-family: var(--font-body);
}

.st-switch-tab {
    background: none;
    border: none;
    color: var(--color-red);
    font-weight: 700;
    font-family: var(--font-body);
    font-size: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.st-switch-tab:hover {
    color: var(--color-red-dark);
}

/* ========== PANEL ========== */
.st-auth-modal__panel[hidden] {
    display: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
    .st-auth-modal__box {
        padding: 32px 20px 24px;
    }

    .st-auth-modal__title {
        font-size: 1.2rem;
    }
}
