:root {
    --z-overlay: 1000;
    --z-drawer:  1001;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4); /* Slight transparency */
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* The Drawer itself (Slides from right) */
.modal-drawer {
    --c-primary: #ff5c33;
    position: fixed;
    top: 0;
    right: 0;
    overflow-y: auto; /* вертикальный скролл */
    height: 100vh;
    width: 50vw; /* Half screen */
    min-width: 400px;
    max-width: 700px;
    background: #fafafa; /* Light gray from screenshot */
    z-index: var(--z-drawer);
    transform: translateX(100%); /* Start off-screen */
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    padding: 60px 80px;
    display: flex;
    flex-direction: column;
    /*justify-content: center; */
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

.modal-drawer.open {
    transform: translateX(0); /* Slide in */
    overflow-y: auto; /* вертикальный скролл */
}

/* Close Button (X) */
.btn-close {
    position: absolute;
    top: 40px;
    left: 40px; /* On the screenshot close is on left or right? Usually right for drawers, but let's follow standard UX or Image. Image shows X at top right relative to modal content area, or top left. Let's put top right of drawer. */
    right: 40px;
    left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}
.btn-close svg {
    width: 24px;
    height: 24px;
    stroke: #111;
    stroke-width: 1.5;
}

/* Form Content */
.auth-title {
    font-family: var(--font-heading);
    font-size: 48px;
    font-weight: 500;
    color: #000;
    margin-bottom: 40px;
}
.login-error {
    color: #ff4a29;
}

.form-group-login {
    margin-bottom: 24px;
    position: relative;
}

.input-field {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid #000;
    border-radius: 6px;
    background: transparent;
    font-size: 16px;
    font-family: var(--font-body);
    color: #111;
    outline: none;
}

.input-field::placeholder {
    color: #999;
}
.input-field:focus {
    border-color: var(--c-primary); /* Orange border */
    border-width: 1px;
}

/* Active State (Password Field) */

/* Floating Label Trick */
.floating-label {
    position: absolute;
    top: -8px;
    left: 16px;
    background: #fafafa; /* Matches drawer bg to hide border */
    padding: 0 6px;
    font-size: 13px;
    color: #111;
    line-height: 1;
}
.floating-label span {
    color: var(--c-primary);
}

.forgot-link {
    display: block;
    text-align: right;
    font-size: 14px;
    color: #111;
    text-decoration: none;
    margin-top: -10px;
    margin-bottom: 30px;
}

.btn-auth-submit {
    width: 100%;
    background: var(--c-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 16px;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    margin-bottom: 24px;
    transition: background 0.2s;
}
.btn-auth-submit:hover {
    background: #c95735;
}
.btn-auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* One-line row: [☑ Запомнить меня]  [Забыли пароль?] */
.auth-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
/* Override the default block/margin behaviour of forgot-link when inside the row */
.auth-meta-row .forgot-link {
    display: inline;
    margin: 0;
    text-align: left;
}
.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #111;
    cursor: pointer;
    user-select: none;
}
.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--c-primary);
    flex-shrink: 0;
}

.register-link {
    display: block;
    text-align: center;
    font-size: 15px;
    color: #111;
    text-decoration: underline;
    cursor: pointer;
}

/* Forgot-password block subtitle */
.auth-subtitle {
    font-family: var(--font-body);
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin-top: -20px;
    margin-bottom: 28px;
}

/* Inline success message (forgot-password + resend) */
.login-success {
    font-family: var(--font-body);
    font-size: 14px;
    color: #22a06b;
    line-height: 1.5;
    margin-top: 8px;
}

/* Registration pending-verification state */
.register-success-heading {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px;
}
.register-success-text {
    font-family: var(--font-body);
    font-size: 15px;
    color: #444;
    line-height: 1.65;
    margin: 0 0 16px;
}

/* Password strength bar */
.pwd-strength {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: -14px;
    margin-bottom: 20px;
    min-height: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}
.pwd-strength.active {
    opacity: 1;
}
.pwd-strength-bars {
    display: flex;
    gap: 4px;
}
.pwd-strength-bars span {
    display: block;
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    transition: background 0.2s;
}
.pwd-strength-bars span.filled {
    background: #e0e0e0; /* default, overridden per level */
}
.pwd-strength.lvl-1 .pwd-strength-bars span.filled { background: #e53935; }
.pwd-strength.lvl-2 .pwd-strength-bars span.filled { background: #fb8c00; }
.pwd-strength.lvl-3 .pwd-strength-bars span.filled { background: #7cb342; }
.pwd-strength.lvl-4 .pwd-strength-bars span.filled { background: #2e7d32; }

.pwd-strength-label {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}
.pwd-strength.lvl-1 .pwd-strength-label { color: #e53935; }
.pwd-strength.lvl-2 .pwd-strength-label { color: #fb8c00; }
.pwd-strength.lvl-3 .pwd-strength-label { color: #7cb342; }
.pwd-strength.lvl-4 .pwd-strength-label { color: #2e7d32; }

/* Mobile Adapt */
@media (max-width: 768px) {
    .product-main {
        grid-template-columns: 1fr;
    }
    .modal-drawer {
        width: 100%;
        min-width: 100%;
        padding: 40px 20px;
    }
    .auth-title {
        font-size: 34px;
        margin-bottom: 28px;
    }
    .products-grid {
        grid-template-columns: 1fr 1fr;
    }
    .products-grid > div:nth-child(n + 3) {
        display: none;
    }
}

@media (max-width: 390px) {
    .modal-drawer {
        padding: 32px 16px;
    }
    .auth-title {
        font-size: 28px;
        margin-bottom: 24px;
    }
    .btn-close {
        top: 28px;
        right: 28px;
    }
}
