/* ============================================================
   Elegant Password Protect — style.css
   Fully responsive: mobile-first, tested 320px → desktop
   ============================================================ */

#epp-password-protect,
#epp-password-protect *,
#epp-password-protect *::before,
#epp-password-protect *::after { box-sizing: border-box; }

/* ─────────────────────────────────────────
   WRAPPER — transparent, centers the card
   ───────────────────────────────────────── */
.epp-wrapper {
    /* Design tokens */
    --epp-accent:       #6366f1;
    --epp-accent-dark:  color-mix(in srgb, var(--epp-accent) 75%, #000);
    --epp-accent-glow:  color-mix(in srgb, var(--epp-accent) 25%, transparent);
    --epp-card-bg:      #0f0f1a;
    --epp-border:       rgba(255,255,255,0.10);
    --epp-text-primary: #f0f0f8;
    --epp-text-muted:   rgba(240,240,248,0.50);
    --epp-input-bg:     rgba(255,255,255,0.07);
    --epp-input-border: rgba(255,255,255,0.14);
    --epp-radius-card:  20px;
    --epp-radius-input: 12px;
    --epp-radius-btn:   12px;
    --epp-font:         'Segoe UI', system-ui, -apple-system, sans-serif;

    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Generous vertical breathing room on all screens */
    padding: clamp(24px, 5vw, 56px) clamp(12px, 4vw, 24px);
    background: transparent;
    font-family: var(--epp-font);
    /* Prevent card from touching viewport edges */
    width: 100%;
}

/* Protect plugin UI from aggressive theme defaults */
#epp-password-protect input,
#epp-password-protect button {
    font: inherit;
    line-height: 1.2;
    text-transform: none;
}

#epp-password-protect .epp-input,
#epp-password-protect .epp-submit,
#epp-password-protect .epp-toggle-btn {
    -webkit-appearance: none;
    appearance: none;
}

/* ─────────────────────────────────────────
   CARD
   ───────────────────────────────────────── */
.epp-card {
    position: relative;
    z-index: 1;
    width: 100%;
    /* Fluid: fills narrow screens, caps at 440px on wide ones */
    max-width: 440px;
    background: var(--epp-card-bg);
    border: 1px solid var(--epp-border);
    border-radius: var(--epp-radius-card);
    /* Fluid padding: tighter on small screens */
    padding: clamp(28px, 6vw, 48px) clamp(20px, 6vw, 40px) clamp(24px, 5vw, 40px);
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.45);
    animation: epp-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Ambient blobs clipped inside the card */
.epp-card::before,
.epp-card::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(55px);
    pointer-events: none;
    z-index: 0;
    animation: epp-float 18s linear infinite;
}
.epp-card::before {
    width: 280px; height: 280px;
    background: var(--epp-accent);
    opacity: 0.14;
    top: -110px; left: -70px;
}
.epp-card::after {
    width: 200px; height: 200px;
    background: color-mix(in srgb, var(--epp-accent) 55%, #ec4899);
    opacity: 0.11;
    bottom: -70px; right: -50px;
    animation-duration: 22s;
    animation-direction: reverse;
}

@keyframes epp-float {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(18px, -14px) scale(1.04); }
    66%  { transform: translate(-14px, 10px) scale(0.97); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes epp-card-in {
    from { opacity: 0; transform: translateY(22px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ─────────────────────────────────────────
   LOCK ICON
   ───────────────────────────────────────── */
.epp-icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: clamp(16px, 4vw, 26px);
    position: relative;
    z-index: 1;
}

.epp-lock-icon {
    /* Fluid icon: 40px on tiny screens, 52px on desktop */
    width:  clamp(40px, 8vw, 52px);
    height: clamp(40px, 8vw, 52px);
    stroke: var(--epp-accent);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 12px var(--epp-accent-glow));
}
.epp-lock-body    { fill: color-mix(in srgb, var(--epp-accent) 12%, transparent); }
.epp-lock-shackle { fill: none; }

/* ─────────────────────────────────────────
   TYPOGRAPHY
   ───────────────────────────────────────── */
.epp-headline,
.epp-subtext,
.epp-form,
.epp-footer-note { position: relative; z-index: 1; }

.epp-headline {
    /* Scales smoothly from ~1.25rem (320px) to 1.75rem (desktop) */
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    font-weight: 700;
    color: var(--epp-text-primary);
    text-align: center;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 0 0 10px;
    /* Prevent overflow on tiny screens */
    word-break: break-word;
    overflow-wrap: break-word;
}

.epp-subtext {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    color: var(--epp-text-muted);
    text-align: center;
    line-height: 1.65;
    margin: 0 0 clamp(20px, 5vw, 30px);
    word-break: break-word;
}

/* ─────────────────────────────────────────
   FORM
   ───────────────────────────────────────── */
.epp-form {
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 3vw, 20px);
}

.epp-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.epp-label {
    font-size: clamp(0.68rem, 2vw, 0.75rem);
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--epp-text-muted);
}

/* ─────────────────────────────────────────
   INPUT GROUP
   ───────────────────────────────────────── */
.epp-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.epp-input-icon {
    position: absolute;
    left: 13px;
    width: 17px; height: 17px;
    stroke: var(--epp-text-muted);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    pointer-events: none;
    transition: stroke 0.2s;
    /* Never shrink the icon on very small screens */
    flex-shrink: 0;
}
.epp-input-group:focus-within .epp-input-icon { stroke: var(--epp-accent); }

.epp-input {
    width: 100%;
    /* Tall enough tap target (≥48px) on mobile */
    padding: clamp(13px, 3vw, 15px) 48px clamp(13px, 3vw, 15px) 42px;
    background: var(--epp-input-bg);
    border: 1px solid var(--epp-input-border);
    border-radius: var(--epp-radius-input);
    color: var(--epp-text-primary);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-family: inherit;
    letter-spacing: 0.04em;
    outline: none;
    /* Prevent iOS zoom on focus (font-size ≥ 16px equivalent handled via clamp) */
    -webkit-text-size-adjust: 100%;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    /* Full width, never overflow */
    min-width: 0;
}
.epp-input::placeholder { color: rgba(240,240,248,0.25); }
.epp-input:focus {
    border-color: var(--epp-accent);
    background: color-mix(in srgb, var(--epp-input-bg) 80%, var(--epp-accent) 6%);
    box-shadow: 0 0 0 3px var(--epp-accent-glow),
                inset 0 0 0 1px var(--epp-accent);
}

/* Error state */
.epp-input.epp-input--error {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248,113,113,0.20);
    animation: epp-shake 0.38s ease;
}
@keyframes epp-shake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}

/* ─────────────────────────────────────────
   SHOW / HIDE TOGGLE
   ───────────────────────────────────────── */
.epp-toggle-btn {
    position: absolute;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 44×44 minimum tap target (WCAG 2.5.5) */
    width: 44px; height: 44px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--epp-text-muted);
    padding: 0;
    transition: color 0.2s, background 0.2s;
    /* Keep it visually compact while keeping the tap area large */
    -webkit-tap-highlight-color: transparent;
}
.epp-toggle-btn:hover {
    color: var(--epp-text-primary);
    background: rgba(255,255,255,0.08);
}
.epp-toggle-btn:focus-visible {
    outline: 2px solid var(--epp-accent);
    outline-offset: 2px;
}

.epp-eye {
    width: 18px; height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    /* Prevent icon from being tappable target itself */
    pointer-events: none;
}

/* ─────────────────────────────────────────
   ERROR MESSAGE
   ───────────────────────────────────────── */
.epp-error-msg {
    font-size: clamp(0.72rem, 2vw, 0.8rem);
    color: #f87171;
    min-height: 1.1em;
    line-height: 1.4;
}

/* ─────────────────────────────────────────
   SUBMIT BUTTON
   ───────────────────────────────────────── */
.epp-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    /* Full width so it's easy to tap on mobile */
    width: 100%;
    /* Minimum 48px height for tap comfort */
    padding: clamp(13px, 3vw, 15px) 26px;
    background: var(--epp-accent);
    border: none;
    border-radius: var(--epp-radius-btn);
    color: #fff;
    font-size: clamp(0.88rem, 2.5vw, 0.95rem);
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 4px 20px var(--epp-accent-glow);
}
.epp-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.16) 0%, transparent 55%);
    pointer-events: none;
}
.epp-submit:hover {
    background: var(--epp-accent-dark);
    box-shadow: 0 6px 28px var(--epp-accent-glow);
    transform: translateY(-1px);
}
.epp-submit:active  { transform: translateY(1px); }
.epp-submit:focus-visible { outline: 2px solid var(--epp-accent); outline-offset: 3px; }

.epp-arrow {
    width: 17px; height: 17px;
    stroke: #fff; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
    fill: none;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.epp-submit:hover .epp-arrow { transform: translateX(3px); }

/* Loading state */
.epp-submit-loader {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: epp-spin 0.7s linear infinite;
    flex-shrink: 0;
}
.epp-submit.epp-loading .epp-submit-text,
.epp-submit.epp-loading .epp-arrow   { opacity: 0; }
.epp-submit.epp-loading .epp-submit-loader { display: block; }
@keyframes epp-spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────
   FOOTER NOTE
   ───────────────────────────────────────── */
.epp-footer-note {
    margin-top: clamp(14px, 3vw, 20px);
    font-size: clamp(0.7rem, 2vw, 0.76rem);
    color: var(--epp-text-muted);
    text-align: center;
    line-height: 1.5;
}

/* ─────────────────────────────────────────
   EXTRA-SMALL SCREENS (< 360px)
   e.g. Galaxy A series, older iPhones
   ───────────────────────────────────────── */
@media (max-width: 359px) {
    .epp-card {
        border-radius: 16px;
    }
    .epp-input {
        font-size: 1rem; /* Force ≥16px to prevent iOS auto-zoom */
        padding-left: 38px;
        padding-right: 44px;
    }
    .epp-input-icon { left: 11px; }
}

/* ─────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .epp-card,
    .epp-card::before,
    .epp-card::after { animation: none; }
    .epp-input,
    .epp-submit      { transition: none; }
}

/* ─────────────────────────────────────────
   HARD THEME ISOLATION
   Use ID-scoped + !important rules to defeat
   aggressive theme/base selectors.
   ───────────────────────────────────────── */
#epp-password-protect {
    isolation: isolate;
}

#epp-password-protect :where(h1, p, form, label, span, svg) {
    margin: 0;
}

#epp-password-protect :where(input, button) {
    margin: 0 !important;
    font: inherit !important;
    text-transform: none !important;
    letter-spacing: inherit !important;
}

#epp-password-protect .epp-wrapper {
    display: flex !important;
    width: 100% !important;
    background: transparent !important;
}

#epp-password-protect .epp-card {
    width: 100% !important;
    max-width: 440px !important;
    background: var(--epp-card-bg) !important;
    border: 1px solid var(--epp-border) !important;
    border-radius: var(--epp-radius-card) !important;
}

#epp-password-protect .epp-headline {
    color: var(--epp-text-primary) !important;
    text-align: center !important;
}

#epp-password-protect .epp-subtext,
#epp-password-protect .epp-label,
#epp-password-protect .epp-footer-note {
    color: var(--epp-text-muted) !important;
}

#epp-password-protect .epp-input {
    width: 100% !important;
    padding: clamp(13px, 3vw, 15px) 48px clamp(13px, 3vw, 15px) 42px !important;
    background: var(--epp-input-bg) !important;
    border: 1px solid var(--epp-input-border) !important;
    border-radius: var(--epp-radius-input) !important;
    color: var(--epp-text-primary) !important;
    box-shadow: none;
}

#epp-password-protect .epp-input::placeholder {
    color: rgba(240,240,248,0.25) !important;
}

#epp-password-protect .epp-toggle-btn {
    position: absolute !important;
    right: 10px !important;
    width: 44px !important;
    height: 44px !important;
    border: none !important;
    background: transparent !important;
    color: var(--epp-text-muted) !important;
}

#epp-password-protect .epp-submit {
    display: flex !important;
    width: 100% !important;
    border: none !important;
    border-radius: var(--epp-radius-btn) !important;
    background: var(--epp-accent) !important;
    color: #fff !important;
    text-align: center !important;
}

#epp-password-protect .epp-arrow {
    stroke: #fff !important;
}
