/* BCL Checkout Login Gate — Popup Styles */

/* Overlay */
#bcl-cl-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99998;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: bclFadeIn 0.2s ease;
}

#bcl-cl-overlay.bcl-open {
    display: block;
}

/* Popup wrapper */
#bcl-cl-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
}

#bcl-cl-popup.bcl-open {
    pointer-events: all;
}

/* Inner card */
.bcl-popup-inner {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
    animation: bclSlideUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    overscroll-behavior: contain;
}

@media (prefers-color-scheme: dark) {
    .bcl-popup-inner {
        background: #1a1a1a;
        color: #e8e8e8;
    }
}

/* Header */
.bcl-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0;
}

.bcl-popup-logo {
    height: 32px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.bcl-popup-sitename {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    letter-spacing: -0.02em;
}

@media (prefers-color-scheme: dark) {
    .bcl-popup-sitename { color: #f0f0f0; }
}

.bcl-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.bcl-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

@media (prefers-color-scheme: dark) {
    .bcl-close-btn:hover { background: #2a2a2a; color: #e0e0e0; }
}

/* Title area */
.bcl-popup-title-area {
    padding: 1rem 1.5rem 0;
}

.bcl-popup-title-area h2 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.bcl-popup-title-area p {
    margin: 0;
    font-size: 13.5px;
    color: #666;
    line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
    .bcl-popup-title-area h2 { color: #f0f0f0; }
    .bcl-popup-title-area p  { color: #999; }
}

/* Cart notice */
.bcl-cart-notice {
    margin: 1rem 1.5rem 0;
    background: #eef6ff;
    border: 1px solid #c3dfff;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #1a5ca8;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.bcl-cart-notice svg {
    flex-shrink: 0;
    margin-top: 1px;
}

@media (prefers-color-scheme: dark) {
    .bcl-cart-notice {
        background: #0d2847;
        border-color: #1a4a80;
        color: #90c8ff;
    }
}

/* Tabs */
.bcl-tabs {
    display: flex;
    padding: 1rem 1.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 0;
}

@media (prefers-color-scheme: dark) {
    .bcl-tabs { border-bottom-color: #2a2a2a; }
}

.bcl-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #888;
    padding: 8px 16px;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    border-radius: 0;
}

.bcl-tab.active {
    color: var(--bcl-accent, #534AB7);
    border-bottom-color: var(--bcl-accent, #534AB7);
}

.bcl-tab:hover:not(.active) {
    color: #444;
}

@media (prefers-color-scheme: dark) {
    .bcl-tab { color: #666; }
    .bcl-tab:hover:not(.active) { color: #bbb; }
}

/* Panels */
.bcl-panel {
    padding: 1.25rem 1.5rem 0;
}

.bcl-panel[hidden] {
    display: none;
}

/* Fields */
.bcl-field {
    margin-bottom: 14px;
}

.bcl-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bcl-field label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
}

@media (prefers-color-scheme: dark) {
    .bcl-field label { color: #aaa; }
}

.bcl-field input[type="text"],
.bcl-field input[type="email"],
.bcl-field input[type="password"] {
    width: 100%;
    height: 40px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
    color: #111;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.bcl-field input:focus {
    border-color: var(--bcl-accent, #534AB7);
    box-shadow: 0 0 0 3px var(--bcl-accent-ring, rgba(83, 74, 183, 0.12));
}

.bcl-field input::placeholder {
    color: #bbb;
}

@media (prefers-color-scheme: dark) {
    .bcl-field input[type="text"],
    .bcl-field input[type="email"],
    .bcl-field input[type="password"] {
        background: #252525;
        border-color: #333;
        color: #e8e8e8;
    }
    .bcl-field input::placeholder { color: #555; }
}

/* Forgot link */
.bcl-forgot-link {
    font-size: 12px;
    color: var(--bcl-accent, #534AB7);
    text-decoration: none;
    font-weight: 400;
}

.bcl-forgot-link:hover {
    text-decoration: underline;
}

/* Primary button */
.bcl-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    background: var(--bcl-accent, #534AB7);
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    letter-spacing: -0.01em;
}

.bcl-btn-primary:hover {
    background: var(--bcl-accent-dark, #3C3489);
    box-shadow: 0 4px 12px rgba(83, 74, 183, 0.3);
}

.bcl-btn-primary:active {
    transform: scale(0.98);
}

.bcl-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.bcl-btn-primary.bcl-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bclSpin 0.7s linear infinite;
    margin-left: 4px;
}

/* Error messages */
.bcl-error-msg {
    background: #fff2f2;
    border: 1px solid #ffcdd2;
    border-radius: 9px;
    padding: 10px 13px;
    font-size: 13px;
    color: #c62828;
    margin-bottom: 14px;
    line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
    .bcl-error-msg {
        background: #2d0a0a;
        border-color: #5c1a1a;
        color: #ff8a8a;
    }
}

/* Divider */
.bcl-divider {
    text-align: center;
    font-size: 12px;
    color: #bbb;
    margin: 14px 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bcl-divider::before,
.bcl-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #eee;
}

@media (prefers-color-scheme: dark) {
    .bcl-divider { color: #555; }
    .bcl-divider::before,
    .bcl-divider::after { background: #2a2a2a; }
}

/* Social buttons */
.bcl-social-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 2px;
}

.bcl-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    background: #f8f8f8;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.bcl-social-btn:hover {
    background: #f0f0f0;
    border-color: #d8d8d8;
}

@media (prefers-color-scheme: dark) {
    .bcl-social-btn {
        background: #252525;
        border-color: #333;
        color: #e0e0e0;
    }
    .bcl-social-btn:hover { background: #2d2d2d; }
}

/* Switch tab link */
.bcl-switch-tab {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin: 14px 0 0;
    padding-bottom: 1.25rem;
}

.bcl-link-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--bcl-accent, #534AB7);
    font-size: 13px;
    font-weight: 500;
    padding: 0;
    text-decoration: none;
}

.bcl-link-btn:hover {
    text-decoration: underline;
}

/* Footer */
.bcl-popup-footer {
    border-top: 1px solid #f0f0f0;
    padding: 10px 1.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #aaa;
}

@media (prefers-color-scheme: dark) {
    .bcl-popup-footer {
        border-top-color: #2a2a2a;
        color: #555;
    }
}

/* Animations */
@keyframes bclFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes bclSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bclSpin {
    to { transform: rotate(360deg); }
}

/* Prevent body scroll when popup is open */
body.bcl-popup-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 480px) {
    .bcl-popup-inner {
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
    }
    #bcl-cl-popup {
        align-items: flex-end;
        padding: 0;
    }
    .bcl-field-row {
        grid-template-columns: 1fr;
    }
    .bcl-social-btns {
        grid-template-columns: 1fr;
    }
}
