/* ============================================================
   Panorama Demo - Стилі сторінки /demo/
   Використовує CSS-змінні теми (--primary-color і т.д.)
   ============================================================ */

/* ─── Базові змінні (fallback якщо тема не задає) ─────────── */
.panorama-demo-page {
    --pd-primary:    var(--primary-color,        #667eea);
    --pd-primary-dk: var(--primary-dark,         #5a6fd6);
    --pd-accent:     var(--accent-color,         #f6c90e);
    --pd-bg:         var(--section-bg,           #0f1117);
    --pd-card-bg:    var(--card-bg,              #1a1d2e);
    --pd-text:       var(--text-color,           #e2e8f0);
    --pd-muted:      var(--muted-color,          #8892a4);
    --pd-border:     rgba(255,255,255,.08);
    --pd-radius:     var(--card-radius-px,       16px);
    --pd-btn-radius: var(--button-radius-px,     12px);
    font-family: var(--font-family, 'Inter', sans-serif);
}

/* ─── Honeypot (прихований від людей) ─────────────────────── */
.pd-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ─── Hero ─────────────────────────────────────────────────── */
.pd-hero {
    position: relative;
    overflow: hidden;
    padding: 80px 0 60px;
    text-align: center;
    background: var(--pd-bg);
}

.pd-hero__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.pd-hero__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .25;
}

.pd-hero__orb--1 {
    width: 500px; height: 500px;
    background: var(--pd-primary);
    top: -200px; left: -100px;
}

.pd-hero__orb--2 {
    width: 400px; height: 400px;
    background: var(--pd-accent);
    bottom: -150px; right: -80px;
}

.pd-hero__inner {
    position: relative;
    z-index: 1;
}

.pd-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 100px;
    background: rgba(102,126,234,.15);
    border: 1px solid rgba(102,126,234,.3);
    color: var(--pd-primary);
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.pd-hero__badge-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: pd-pulse 2s infinite;
}

@keyframes pd-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .5; transform: scale(1.3); }
}

.pd-hero__title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: var(--pd-text);
    margin: 0 0 16px;
    line-height: 1.15;
}

.pd-hero__subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--pd-muted);
    max-width: 560px;
    margin: 0 auto;
}

/* ─── Layout ────────────────────────────────────────────────── */
.pd-form-section {
    background: var(--pd-bg);
    padding: 48px 0 80px;
}

.pd-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 900px) {
    .pd-layout {
        grid-template-columns: 1fr;
    }
}

/* ─── Картка форми ──────────────────────────────────────────── */
.pd-card {
    background: var(--pd-card-bg);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius);
    padding: 36px;
}

.pd-card__header {
    margin-bottom: 28px;
}

.pd-card__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pd-text);
    margin: 0 0 8px;
}

.pd-card__desc {
    color: var(--pd-muted);
    margin: 0;
    font-size: .95rem;
}

/* ─── Поля форми ────────────────────────────────────────────── */
.pd-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pd-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pd-field__label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--pd-text);
}

.pd-field__required {
    color: #f87171;
    margin-left: 2px;
}

.pd-field__input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,.05);
    border: 1px solid var(--pd-border);
    border-radius: 10px;
    color: var(--pd-text);
    font-size: 1rem;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.pd-field__input:focus {
    outline: none;
    border-color: var(--pd-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.2);
}

.pd-field__input::placeholder {
    color: var(--pd-muted);
    opacity: .7;
}

.pd-field__hint {
    font-size: .8rem;
    color: var(--pd-muted);
}

/* datetime-local */
input[type="datetime-local"].pd-field__input::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(.4);
    cursor: pointer;
}

/* Пароль */
.pd-field__pass-wrap {
    position: relative;
}

.pd-field__pass-wrap .pd-field__input {
    padding-right: 48px;
}

.pd-pass-toggle {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--pd-muted);
    padding: 0;
    line-height: 1;
}

.pd-pass-toggle:hover { color: var(--pd-text); }

/* ─── Чекбокс ───────────────────────────────────────────────── */
.pd-field--checkbox { flex-direction: row; align-items: flex-start; }

.pd-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.pd-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}

.pd-checkbox__box {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border-radius: 5px;
    border: 2px solid var(--pd-border);
    background: rgba(255,255,255,.05);
    transition: border-color .2s, background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.pd-checkbox input:checked + .pd-checkbox__box {
    background: var(--pd-primary);
    border-color: var(--pd-primary);
}

.pd-checkbox input:checked + .pd-checkbox__box::after {
    content: '';
    display: block;
    width: 5px; height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}

.pd-checkbox__text {
    font-size: .9rem;
    color: var(--pd-muted);
    line-height: 1.5;
}

.pd-checkbox__text a {
    color: var(--pd-primary);
    text-decoration: none;
}

.pd-checkbox__text a:hover { text-decoration: underline; }

/* ─── Кнопки ────────────────────────────────────────────────── */
.pd-form__footer { margin-top: 8px; }

.pd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--pd-btn-radius);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .2s, transform .15s, box-shadow .2s;
    white-space: nowrap;
}

.pd-btn:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.pd-btn:active:not(:disabled) { transform: translateY(0); }

.pd-btn--primary {
    background: linear-gradient(135deg, var(--pd-primary), var(--pd-primary-dk));
    color: #fff;
    box-shadow: 0 4px 20px rgba(102,126,234,.35);
}

.pd-btn--outline {
    background: transparent;
    border: 2px solid var(--pd-primary);
    color: var(--pd-primary);
}

.pd-btn--full { width: 100%; }

.pd-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none !important;
}

/* Spinner */
.pd-btn__spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pd-spin .7s linear infinite;
}

.pd-btn--loading .pd-btn__text { display: none; }
.pd-btn--loading .pd-btn__spinner { display: block; }

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

/* ─── Alert ─────────────────────────────────────────────────── */
.pd-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .9rem;
}

.pd-alert--error {
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
}

.pd-alert--success {
    background: rgba(34,197,94,.12);
    border: 1px solid rgba(34,197,94,.3);
    color: #86efac;
}

/* ─── Info sidebar ──────────────────────────────────────────── */
.pd-info {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pd-info__section {
    background: var(--pd-card-bg);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius);
    padding: 24px;
}

.pd-info__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--pd-text);
    margin: 0 0 16px;
}

/* Steps */
.pd-steps {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pd-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pd-step__num {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--pd-primary);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-step__text {
    margin: 0;
    color: var(--pd-muted);
    font-size: .9rem;
    line-height: 1.5;
    padding-top: 4px;
}

/* Limits */
.pd-info__limits { background: rgba(246,201,14,.04); border-color: rgba(246,201,14,.15); }

.pd-limits {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pd-limits li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: .88rem;
    color: var(--pd-muted);
    line-height: 1.5;
}

.pd-limits__icon { font-size: 1rem; flex-shrink: 0; }

/* Upgrade CTA */
.pd-info__cta {
    text-align: center;
}

.pd-info__cta p {
    color: var(--pd-muted);
    font-size: .9rem;
    margin: 0 0 12px;
}

.pd-info__cta .pd-btn--outline {
    width: 100%;
}

/* ─── Char counter ──────────────────────────────────────────── */
.pd-char-counter { display: flex; gap: 4px; }

/* ─── Стан помилки поля ─────────────────────────────────────── */
.pd-field--error .pd-field__input {
    border-color: rgba(239,68,68,.6) !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}

.pd-field__error-msg {
    margin-top: 6px;
    font-size: .85rem;
    color: #fca5a5;
}

/* ─── Modal ──────────────────────────────────────────────────── */
.pd-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pd-modal[hidden] { display: none; }

.pd-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(5,7,15,.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.pd-modal__box {
    position: relative;
    z-index: 1;
    background: var(--pd-card-bg, #1a1d2e);
    border: 1px solid rgba(102,126,234,.25);
    border-radius: 20px;
    padding: 40px 36px 32px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(102,126,234,.1);
    animation: pd-modal-in .25s cubic-bezier(.34,1.56,.64,1) both;
    text-align: center;
}

@keyframes pd-modal-in {
    from { opacity: 0; transform: scale(.9) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.pd-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--pd-muted, #8892a4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    padding: 0;
}

.pd-modal__close:hover { background: rgba(255,255,255,.12); color: var(--pd-text, #e2e8f0); }

.pd-modal__icon {
    font-size: 2.8rem;
    margin-bottom: 16px;
    line-height: 1;
}

.pd-modal__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--pd-text, #e2e8f0);
    margin: 0 0 8px;
    letter-spacing: -.02em;
}

.pd-modal__subtitle {
    font-size: .9rem;
    color: var(--pd-muted, #8892a4);
    margin: 0 0 20px;
}

.pd-modal__steps-section {
    text-align: left;
    margin-bottom: 24px;
    background: rgba(102,126,234,.06);
    border-color: rgba(102,126,234,.2);
}

.pd-modal__steps-section .pd-step__text {
    font-size: .92rem;
}

.pd-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.pd-modal__actions .pd-btn {
    min-width: 140px;
}

.pd-modal__actions .pd-btn--outline {
    color: var(--pd-muted, #8892a4);
    border-color: rgba(255,255,255,.15);
}

.pd-modal__actions .pd-btn--outline:hover:not(:disabled) {
    border-color: rgba(255,255,255,.3);
    color: var(--pd-text, #e2e8f0);
}

#pd-modal-error { margin-top: 16px; text-align: left; }

/* Блокуємо прокрутку сторінки поки модалка відкрита */
body.pd-modal-open { overflow: hidden; }

/* ─── Container (якщо тема не визначає) ─────────────────────── */
.panorama-demo-page .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 600px) {
    .pd-card { padding: 24px 20px; }
    .pd-hero { padding: 48px 0 36px; }
    .pd-modal__box { padding: 32px 20px 24px; }
    .pd-modal__actions { flex-direction: column-reverse; }
    .pd-modal__actions .pd-btn { width: 100%; }
}
