/*
 * Private Note Locker — Frontend Styles
 * Version: 1.0.0
 *
 * All selectors are prefixed with .pnl- to avoid any conflicts
 * with the active WordPress theme or other plugins.
 *
 * Fonts: Space Mono (monospace UI) + Sora (body text)
 * Loaded via @import — swap with wp_enqueue_style if self-hosting fonts.
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Sora:wght@400;600;700&display=swap');

/* ================================================================
   KEYFRAME ANIMATIONS
================================================================ */
@keyframes pnl-shake {
    0%,  100% { transform: translateX(0);   }
    20%        { transform: translateX(-6px); }
    60%        { transform: translateX(6px);  }
    80%        { transform: translateX(-3px); }
}

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

/* ================================================================
   WIDGET RESET
   Scoped reset so host theme styles don't bleed in.
================================================================ */
.pnl-widget,
.pnl-widget *,
.pnl-widget *::before,
.pnl-widget *::after {
    box-sizing: border-box;
}

.pnl-widget p,
.pnl-widget h3,
.pnl-widget ul,
.pnl-widget ol {
    margin: 0;
    padding: 0;
}

/* ================================================================
   WIDGET ROOT
================================================================ */
.pnl-widget {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    background: #10152a;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-shadow:
        0 0 0 1px rgba(99, 102, 241, 0.08),
        0 40px 100px rgba(0, 0, 0, 0.7),
        0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Top shimmer accent line */
.pnl-shimmer-line {
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(129, 140, 248, 0.5),
        transparent
    );
    z-index: 1;
    pointer-events: none;
}

/* ================================================================
   HEADER
================================================================ */
.pnl-header {
    padding: 26px 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    position: relative;
}

.pnl-description {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ── Badge ── */
.pnl-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background 0.4s, border-color 0.4s, color 0.4s;
}

.pnl-badge-icon {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.pnl-badge-text {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

/* Red / locked */
.pnl-badge--locked {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Green / open (no password) */
.pnl-badge--open {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #4ade80;
}

/* Green / unlocked */
.pnl-badge--unlocked {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

/* ── Title ── */
.pnl-title {
    font-size: 28px !important;
    font-weight: 700 !important;
    color: #eef2ff !important;
    letter-spacing: -0.5px !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
}

/* ── Description (hidden after unlock) ── */
.pnl-description {
    font-size: 13px !important;
    color: rgba(255, 255, 255, 0.35) !important;
    line-height: 1.65 !important;
    max-width: 400px;
    margin: 0 !important;
}

/* ── Session line (shown after unlock) ── */
.pnl-session-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.3);
}

.pnl-session-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.pnl-session-text {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ================================================================
   BODY
================================================================ */
.pnl-body {
    padding: 0 20px 26px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ================================================================
   LOCKED CARD (unified border — image + form in one box)
================================================================ */
.pnl-locked-card {
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.025);
    display: flex;
    flex-direction: column;
    transition: opacity 0.4s ease;
}

/* ── Locked image block ── */
.pnl-locked-image-block {
    position: relative;
    height: 230px;
    overflow: hidden;
    /* CSS gradient fallback (always present as base) */
    background:
        radial-gradient(ellipse at 22% 38%, rgba(90,  50, 200, 0.65) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 68%, rgba(18,  80, 200, 0.55) 0%, transparent 52%),
        radial-gradient(ellipse at 60% 10%, rgba(170, 35, 195, 0.40) 0%, transparent 48%),
        radial-gradient(ellipse at 40% 80%, rgba(30,  60, 160, 0.35) 0%, transparent 45%),
        linear-gradient(155deg, #1a1045 0%, #0c1530 100%);
}

/* Image element (blurred preview) */
.pnl-locked-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: blur(6px) brightness(0.42) saturate(1.3);
    transform: scale(1.07); /* hide blur edges */
}

/* Colour overlay on top of image */
.pnl-locked-overlay {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background:
        radial-gradient(ellipse at 22% 38%, rgba(90,  50, 200, 0.45) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 68%, rgba(18,  80, 200, 0.40) 0%, transparent 52%),
        linear-gradient(to bottom, rgba(16, 21, 42, 0.30) 0%, rgba(16, 21, 42, 0.65) 100%);
    pointer-events: none;
}

/* Pure gradient fallback (no image) */
.pnl-locked-image-gradient {
    width: 100%;
    height: 100%;
}

/* Lock icon centred over image */
.pnl-locked-image-ui {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.pnl-lock-box {
    width: 58px;
    height: 58px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5);
    color: #818cf8;
}

.pnl-lock-box svg {
    width: 26px;
    height: 26px;
}

.pnl-encrypted-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 3.5px;
    color: rgba(255, 255, 255, 0.28);
    text-transform: uppercase;
}

/* ── Divider inside the locked card ── */
.pnl-in-card-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

/* ── Password form area ── */
.pnl-form-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 18px 20px;
}

/* ── Input wrapper ── */
.pnl-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* Password input */
.pnl-password-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    border-radius: 11px !important;
    padding: 15px 50px 15px 18px !important;
    font-family: 'Space Mono', monospace !important;
    font-size: 13px !important;
    letter-spacing: 1.5px !important;
    color: #e2e8f0 !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box !important;
    transition: border-color 0.25s, box-shadow 0.25s;
    box-shadow: none !important;
}

.pnl-password-input::placeholder {
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    letter-spacing: 0;
    color: rgba(255, 255, 255, 0.22);
}

.pnl-password-input:focus {
    border-color: rgba(129, 140, 248, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.10) !important;
}

.pnl-password-input.pnl-input--error {
    border-color: rgba(239, 68, 68, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
    animation: pnl-shake 0.35s ease;
}

/* Eye toggle button */
.pnl-eye-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none;
    transition: color 0.2s;
}

.pnl-eye-toggle:hover {
    color: rgba(255, 255, 255, 0.6);
}

.pnl-eye-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Error message */
.pnl-error-msg {
    font-family: 'Space Mono', monospace !important;
    font-size: 11px !important;
    color: #f87171 !important;
    letter-spacing: 0.4px;
    margin: 0 !important;
    min-height: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pnl-error-msg.pnl-error--visible {
    display: block;
    opacity: 1;
}

/* Unlock button — default indigo (password mode) */
.pnl-unlock-btn {
    width: 100%;
    padding: 15px !important;
    background: linear-gradient(135deg, #5f63f2 0%, #818cf8 100%) !important;
    border: none !important;
    border-radius: 11px !important;
    color: #fff !important;
    font-family: 'Space Mono', monospace !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 2.5px !important;
    text-transform: uppercase !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.38) !important;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Green variant — open mode */
.pnl-unlock-btn--open {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%) !important;
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.35) !important;
}

.pnl-unlock-btn--open:hover:not(:disabled) {
    box-shadow: 0 10px 32px rgba(34, 197, 94, 0.48) !important;
}

.pnl-unlock-btn::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.pnl-unlock-btn:hover:not(:disabled) {
    opacity: 0.91;
    transform: translateY(-1px);
    box-shadow: 0 10px 32px rgba(99, 102, 241, 0.48) !important;
}

.pnl-unlock-btn:active:not(:disabled) {
    transform: translateY(0);
    opacity: 1;
}

.pnl-unlock-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading spinner inside button */
.pnl-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pnl-spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* ================================================================
   CONTENT BLOCK (revealed after unlock)
================================================================ */
.pnl-content-block {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 20px 20px 18px;
    position: relative;
}

.pnl-content-block.pnl-content--visible {
    opacity: 1;
    transform: none;
}

/* Copy button */
.pnl-copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 7px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.3);
    transition: background 0.2s, color 0.2s;
    padding: 0 !important;
    box-shadow: none !important;
}

.pnl-copy-btn:hover {
    background: rgba(255, 255, 255, 0.10) !important;
    color: rgba(255, 255, 255, 0.7);
}

.pnl-copy-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Content inner wrapper */
.pnl-content-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Title row */
.pnl-content-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #c7d2fe !important;
    padding-right: 36px;
    line-height: 1.4;
    margin: 0 !important;
}

/* Divider row */
.pnl-content-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
}

/* Content row (link or text) */
.pnl-content-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    margin: 0 !important;
}

/* Dot bullet */
.pnl-content-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.55);
    flex-shrink: 0;
}

/* Label part */
.pnl-content-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

/* Plain text content */
.pnl-content-text {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

/* Link */
.pnl-content-link {
    color: #818cf8 !important;
    text-decoration: none !important;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    border-bottom: 1px solid rgba(129, 140, 248, 0.3) !important;
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}

.pnl-content-link:hover {
    color: #a5b4fc !important;
    border-bottom-color: rgba(165, 180, 252, 0.6) !important;
}

/* ================================================================
   FOOTER
================================================================ */
.pnl-footer {
    padding: 12px 24px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pnl-footer-brand {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 2.5px;
    color: rgba(255, 255, 255, 0.10);
    text-transform: uppercase;
}

/* Footer link (open-mode "KEY OBTAINED VIA ...") */
.pnl-footer-link,
.pnl-footer-highlight {
    color: #4ade80 !important;
    text-decoration: none !important;
    font-weight: 700;
    letter-spacing: 2.5px;
    border-bottom: 1px solid rgba(74, 222, 128, 0.35) !important;
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}

.pnl-footer-link:hover {
    color: #86efac !important;
    border-bottom-color: rgba(134, 239, 172, 0.6) !important;
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 600px) {
    .pnl-widget {
        border-radius: 16px;
    }

    .pnl-title {
        font-size: 22px !important;
    }

    .pnl-locked-image-block {
        height: 180px;
    }
}
