/**
 * SimpleNotify Auth Form Styles
 *
 * Minimal CSS — most styling handled by Tailwind utility classes.
 * CSS custom properties for accent color configuration.
 *
 * @package SimpleNotify
 */

/* ---------------------------------------------------------------------------
 * Custom Properties
 * --------------------------------------------------------------------------- */

:root {
    --sn-btn-primary-bg: #000;
    --sn-btn-primary-text: #fff;
    --sn-btn-outline-border: #D1D5DB;
    --sn-btn-outline-text: #374151;
}

/* ---------------------------------------------------------------------------
 * Alpine.js cloak — hide elements before Alpine initializes
 * --------------------------------------------------------------------------- */

[x-cloak] { display: none !important; }

/* ---------------------------------------------------------------------------
 * OTP box class used by querySelectorAll in JS
 * --------------------------------------------------------------------------- */

.sn-otp-box {
    width: 56px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 1px solid #D1D5DB;
    border-radius: 12px;
    outline: none;
    background: #fff;
    -moz-appearance: textfield;
}

.sn-otp-box::-webkit-outer-spin-button,
.sn-otp-box::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sn-otp-box:focus {
    border-color: #6B7280;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

/* ---------------------------------------------------------------------------
 * Login modal overlay (WooCommerce / page lock)
 * --------------------------------------------------------------------------- */

.sn-login-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}

/* Force any side/mobile navigation behind the modal overlay.
 * Targets Woodmart (.wd-side-hidden), plus common patterns.
 * The body class is toggled by auth.js when the modal opens/closes. */
body.sn-modal-open .wd-side-hidden,
body.sn-modal-open .mobile-nav,
body.sn-modal-open .side-menu,
body.sn-modal-open .off-canvas,
body.sn-modal-open .wd-close-side {
    z-index: 0 !important;
    visibility: hidden !important;
}

.sn-login-modal-box {
    width: 100%;
    max-width: 440px;
}

/* Reset auth form spacing inside modal */
.sn-login-modal-box .sn-auth-wrap {
    margin: 0;
    max-width: none;
    background: #fff !important;
    border-radius: 1rem !important;
    padding: 2rem !important;
}

/* ---------------------------------------------------------------------------
 * Page lock modal overlay
 *
 * Applied by PageLockGuard when a page has simplenotify_page_lock meta.
 * The page DOM is fully rendered behind the overlay for SEO crawlers.
 * --------------------------------------------------------------------------- */

.sn-lock-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sn-lock-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 440px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* ---------------------------------------------------------------------------
 * Responsive OTP boxes
 * --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
 * Social buttons — prevent dark tap highlight on mobile
 * --------------------------------------------------------------------------- */

.sn-auth-wrap button[aria-label="Google"],
.sn-auth-wrap button[aria-label="Facebook"],
.sn-auth-wrap button[aria-label="Apple"] {
    -webkit-tap-highlight-color: transparent;
    border-radius: 50% !important;
    overflow: hidden !important;
}

/* ---------------------------------------------------------------------------
 * Theme-proof form element styles
 *
 * WordPress themes aggressively reset borders, margins, and SVG attributes.
 * Triple-class specificity (.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap) ensures
 * our rules win over any theme — even those using !important.
 * --------------------------------------------------------------------------- */

/* Phone input field — sits inside .sn-phone-row container (no own border) */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="tel"] {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    line-height: normal !important;
}

.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="tel"]:focus {
    outline: none !important;
    box-shadow: none !important;
    border: 0 !important;
}

/* Phone input container — the visible bordered row */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-phone-row,
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap div.sn-phone-row {
    border: 1px solid #D1D5DB !important;
    border-top: 1px solid #D1D5DB !important;
    border-right: 1px solid #D1D5DB !important;
    border-bottom: 1px solid #D1D5DB !important;
    border-left: 1px solid #D1D5DB !important;
    border-radius: 0.75rem !important;
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    outline: none !important;
}

/* Email input — standalone field with its own border */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="email"] {
    border: 1px solid #D1D5DB !important;
    border-top: 1px solid #D1D5DB !important;
    border-right: 1px solid #D1D5DB !important;
    border-bottom: 1px solid #D1D5DB !important;
    border-left: 1px solid #D1D5DB !important;
    border-radius: 0.75rem !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 1.5rem !important;
    line-height: normal !important;
    background: #fff !important;
    background-color: #fff !important;
    padding: 0 1.25rem !important;
    height: 50px !important;
    font-size: 1rem !important;
    color: #111827 !important;
    box-sizing: border-box !important;
}

.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="email"]:focus {
    outline: none !important;
    box-shadow: none !important;
    border: 1px solid #6B7280 !important;
}

/* Registration form text input — standalone field with border */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-reg-input {
    border: 1px solid #D1D5DB !important;
    border-radius: 0.75rem !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    margin-bottom: 0.75rem !important;
    line-height: normal !important;
    background: #fff !important;
    padding: 0 1.25rem !important;
    height: 50px !important;
    font-size: 1rem !important;
    color: #111827 !important;
}

.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-reg-input:focus {
    outline: none !important;
    box-shadow: none !important;
    border: 1px solid #6B7280 !important;
}

/* OTP boxes — triple specificity to guarantee borders survive theme resets */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-otp-box,
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input.sn-otp-box,
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="text"].sn-otp-box {
    border: 1px solid #D1D5DB !important;
    border-top: 1px solid #D1D5DB !important;
    border-right: 1px solid #D1D5DB !important;
    border-bottom: 1px solid #D1D5DB !important;
    border-left: 1px solid #D1D5DB !important;
    border-radius: 12px !important;
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    text-align: center !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    padding: 0 !important;
    margin: 0 !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    outline: none !important;
    display: inline-block !important;
}

.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-otp-box:focus,
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input.sn-otp-box:focus,
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="text"].sn-otp-box:focus {
    border: 1px solid #6B7280 !important;
    border-color: #6B7280 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08) !important;
    outline: none !important;
}

/* Back button — protect border and SVG visibility */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-back-btn {
    border: 1px solid #E5E7EB !important;
    border-radius: 9999px !important;
    background: #fff !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* SVG inside back button — protect stroke from theme overrides */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-back-btn svg {
    stroke: #1a1a1a !important;
    fill: none !important;
    display: inline-block !important;
    visibility: visible !important;
    width: 18px !important;
    height: 18px !important;
    stroke-width: 2 !important;
    opacity: 1 !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Country search input inside dropdown — borderless */
.sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-phone-row input[type="text"] {
    border: 0 !important;
    border-bottom: 1px solid #E5E7EB !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0.5rem 0.75rem !important;
}

.sn-auth-wrap button[aria-label="Google"]:hover,
.sn-auth-wrap button[aria-label="Facebook"]:hover,
.sn-auth-wrap button[aria-label="Apple"]:hover {
    background-color: #F9FAFB !important;
    opacity: 1 !important;
}

.sn-auth-wrap button[aria-label="Google"]:focus,
.sn-auth-wrap button[aria-label="Facebook"]:focus,
.sn-auth-wrap button[aria-label="Apple"]:focus {
    background-color: #fff !important;
    outline: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

.sn-auth-wrap button[aria-label="Google"]:active,
.sn-auth-wrap button[aria-label="Facebook"]:active,
.sn-auth-wrap button[aria-label="Apple"]:active {
    background-color: #F3F4F6 !important;
    opacity: 1 !important;
}

/* Country picker button — force transparent background in all states */
.sn-auth-wrap .sn-phone-row > button {
    background-color: transparent !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-appearance: none;
    appearance: none;
}
.sn-auth-wrap .sn-phone-row > button:active,
.sn-auth-wrap .sn-phone-row > button:focus,
.sn-auth-wrap .sn-phone-row > button:hover {
    background-color: transparent !important;
    outline: none;
}

/* All interactive elements — prevent dark tap on mobile */
.sn-auth-wrap button,
.sn-auth-wrap a {
    -webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------------------
 * Responsive — mobile overflow fix
 * --------------------------------------------------------------------------- */

@media (max-width: 480px) {
    .sn-auth-wrap {
        padding: 24px 16px;
        max-width: 100%;
        border-radius: 16px;
        overflow: hidden;
    }

    /* Shrink buttons and inputs on mobile — keep font-size >= 16px to prevent iOS auto-zoom */
    .sn-auth-wrap button[type="button"]:not([aria-label]) {
        height: 44px !important;
        font-size: 16px !important;
    }

    .sn-auth-wrap input[type="tel"],
    .sn-auth-wrap input[type="email"],
    .sn-auth-wrap .sn-reg-input {
        height: 44px !important;
        font-size: 16px !important;
    }

    /* Phone input row — fit within container */
    .sn-auth-wrap .sn-phone-row {
        height: 44px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Phone input field — prevent overflow */
    .sn-auth-wrap .sn-phone-row input[type="tel"] {
        min-width: 0 !important;
    }

    /* Country picker button — compact on mobile */
    .sn-auth-wrap .sn-phone-row > button {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Smaller avatar */
    .sn-auth-wrap .w-20 {
        width: 64px !important;
        height: 64px !important;
    }

    .sn-auth-wrap .w-20 svg {
        width: 32px !important;
        height: 32px !important;
    }

    /* Smaller social buttons */
    .sn-auth-wrap button[aria-label="Google"],
    .sn-auth-wrap button[aria-label="Facebook"],
    .sn-auth-wrap button[aria-label="Apple"] {
        width: 40px !important;
        height: 40px !important;
    }

    .sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-otp-box,
    .sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input.sn-otp-box,
    .sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="text"].sn-otp-box {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        font-size: 20px !important;
    }

    .sn-login-modal-overlay {
        padding: 10px;
    }

    .sn-lock-content {
        padding: 16px;
        width: 95%;
    }
}

@media (max-width: 360px) {
    .sn-auth-wrap {
        padding: 20px 12px;
    }

    .sn-auth-wrap button[type="button"]:not([aria-label]) {
        height: 40px !important;
        font-size: 16px !important;
    }

    .sn-auth-wrap input[type="tel"],
    .sn-auth-wrap input[type="email"],
    .sn-auth-wrap .sn-reg-input {
        height: 40px !important;
        font-size: 16px !important;
    }

    .sn-auth-wrap .sn-phone-row {
        height: 40px !important;
    }

    /* Country picker — even more compact */
    .sn-auth-wrap .sn-phone-row > button {
        padding-left: 8px !important;
        padding-right: 8px !important;
        gap: 2px !important;
    }

    .sn-auth-wrap.sn-auth-wrap.sn-auth-wrap .sn-otp-box,
    .sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input.sn-otp-box,
    .sn-auth-wrap.sn-auth-wrap.sn-auth-wrap input[type="text"].sn-otp-box {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 18px !important;
        border-radius: 8px !important;
    }
}
