/* plexiframes create page */

:root {
    --pf-primary: #0a0a0a;
    --pf-primary-light: #262626;
    --pf-accent: #1e3a5f;
    --pf-accent-light: #2d5a8e;
    --pf-text: #171717;
    --pf-text-muted: #525252;
    --pf-bg: #fafafa;
    --pf-surface: #ffffff;
    --pf-white: #ffffff;
    --pf-border: #e5e5e5;
    --pf-radius: 16px;
    --pf-error: #ef4444;
    --pf-success: #16a34a;
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.plexiframes-create {
    font-family: var(--font-body);
    background: var(--pf-bg);
    color: var(--pf-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

.create-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================================
   Main Content — Contained
   =========================================== */
.create-main {
    flex: 1;
    padding: 2.5rem 1.5rem;
}

.create-container {
    max-width: 960px;
    margin: 0 auto;
}

/* header */
.create-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.create-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 400;
    color: var(--pf-text);
    margin-bottom: 0.375rem;
}

.create-subtitle {
    color: var(--pf-text-muted);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ===========================================
   Image Uploader Component
   =========================================== */
.image-uploader {
    /* Contained within create-container */
}

/* ===========================================
   Upload Zone
   =========================================== */
.upload-zone {
    background: var(--pf-surface);
    border: 2px dashed var(--pf-border);
    border-radius: var(--pf-radius);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    position: relative;
}

.upload-zone:hover {
    border-color: #a3a3a3;
    background: var(--pf-bg);
}

.upload-zone.dragging {
    border-color: var(--pf-accent);
    background: #eef4fb;
    border-style: solid;
}

.upload-zone.uploading {
    cursor: default;
    pointer-events: none;
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    color: #a3a3a3;
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-title {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--pf-text);
    margin-bottom: 0.5rem;
}

.upload-subtitle {
    color: var(--pf-text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.upload-hint {
    color: var(--pf-text-muted);
    font-size: 0.8125rem;
    opacity: 0.7;
    margin-top: 1.25rem;
}

/* upload button */
.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--pf-primary);
    color: var(--pf-white);
    padding: 0.75rem 1.75rem;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-upload:hover {
    background: var(--pf-primary-light);
    transform: translateY(-1px);
}

.btn-upload:active {
    transform: translateY(0);
}

.btn-upload svg {
    width: 18px;
    height: 18px;
}

/* upload progress */
.upload-progress {
    padding: 1rem;
}

.progress-circle {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    position: relative;
}

.progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: var(--pf-border);
    stroke-width: 8;
}

.progress-bar {
    fill: none;
    stroke: var(--pf-accent);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--pf-primary);
}

.uploading-text {
    color: var(--pf-text-muted);
    font-size: 0.875rem;
}

/* error message */
.upload-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--pf-error);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.upload-error svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ===========================================
   3D Preview
   =========================================== */
.plexi-preview-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: radial-gradient(1200px 700px at 50% 35%, #2a2f3a 0%, #111318 45%, #07080c 100%);
}

.plexi-preview-mount {
    width: 100%;
    height: 100%;
}

.plexi-preview-mount canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ── 3D Preview interaction hint ── */
.preview-hint {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    gap: 2rem;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: hintFadeIn 0.6s ease-out both 1s;
}

.hint-phase {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Rotate: hand drags left-right ── */
.hint-hand-wrap {
    width: 28px;
    height: 28px;
    position: relative;
}

.hint-hand {
    width: 28px;
    height: 28px;
    color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
    animation: handSwipe 2.5s ease-in-out infinite;
}

@keyframes handSwipe {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    30%      { transform: translateX(8px) rotate(6deg); }
    70%      { transform: translateX(-8px) rotate(-6deg); }
}

/* ── Zoom: magnifier pulses ── */
.hint-zoom-wrap {
    width: 28px;
    height: 28px;
    position: relative;
}

.hint-zoom-icon {
    width: 28px;
    height: 28px;
    color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
    animation: zoomBounce 2.5s ease-in-out infinite;
}

@keyframes zoomBounce {
    0%, 100% { transform: scale(1); }
    40%      { transform: scale(1.2); }
    60%      { transform: scale(0.85); }
    80%      { transform: scale(1.05); }
}

/* ── Label ── */
.hint-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ── Divider between the two phases ── */
.hint-phase-rotate {
    padding-right: 2rem;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

@keyframes hintFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Size badge — hidden, size shown in entries list */
.size-badge {
    display: none;
}

/* ===========================================
   Scene Settings — Background Presets
   =========================================== */
.scene-settings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--pf-surface);
    border: 1px solid var(--pf-border);
    border-radius: 12px;
    margin-top: 0.75rem;
}

.preset-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.preset-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pf-text-muted);
    min-width: 80px;
    flex-shrink: 0;
}

.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.preset-chip {
    padding: 0.3rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--pf-border);
    border-radius: 50px;
    background: transparent;
    color: var(--pf-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.preset-chip:hover {
    border-color: #a3a3a3;
    color: var(--pf-text);
}

.preset-chip.active {
    background: var(--pf-primary);
    border-color: var(--pf-primary);
    color: var(--pf-white);
}

.preset-chip.active:hover {
    background: var(--pf-primary-light);
    border-color: var(--pf-primary-light);
}

/* ===========================================
   Compact Upload Zone (hidden — replaced by grid card)
   =========================================== */
.upload-zone-compact {
    display: none;
}

.btn-add-photo {
    display: none;
}

/* compact uploading indicator */
.compact-uploading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--pf-text-muted);
    font-size: 0.875rem;
    padding: 1rem;
}

/* ===========================================
   Photo Grid
   =========================================== */
.uploaded-images {
    margin-top: 1.5rem;
}

.uploaded-title {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--pf-text);
    margin-bottom: 1rem;
}

.uploaded-title .select-hint {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--pf-text-muted);
    font-size: 0.875rem;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.image-preview {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--pf-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    border: 2px solid var(--pf-border);
}

.image-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.image-preview:hover .remove-image {
    opacity: 1;
}

.image-preview.selected {
    border-color: var(--pf-accent);
    box-shadow: 0 0 0 1px var(--pf-accent);
}

.selected-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    background: var(--pf-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.selected-indicator svg {
    width: 14px;
    height: 14px;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.remove-image:hover {
    background: var(--pf-error);
}

.remove-image svg {
    width: 16px;
    height: 16px;
}

.image-resolution {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 50px;
}

/* add more card — in grid */
.add-more-card {
    aspect-ratio: 1;
    border: 2px dashed var(--pf-border);
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--pf-text-muted);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.add-more-card:hover {
    border-color: #a3a3a3;
    color: var(--pf-text);
    background: var(--pf-bg);
}

.add-more-card svg {
    width: 28px;
    height: 28px;
}

.add-more-card span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* legacy fallback */
.add-more-btn {
    aspect-ratio: 1;
    border: 2px dashed var(--pf-border);
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--pf-text-muted);
    transition: all 0.2s ease;
}

.add-more-btn:hover {
    border-color: #a3a3a3;
    color: var(--pf-text);
}

.add-more-btn svg {
    width: 24px;
    height: 24px;
}

.add-more-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===========================================
   Continue Button
   =========================================== */
.upload-actions {
    margin-top: 2rem;
    text-align: center;
}

.btn-continue {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--pf-primary);
    color: var(--pf-white);
    padding: 0.875rem 2rem;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-continue:hover {
    background: var(--pf-primary-light);
    transform: translateY(-1px);
}

.btn-continue svg {
    width: 20px;
    height: 20px;
}

/* ===========================================
   Loading State
   =========================================== */
.upload-zone.loading {
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.loading-spinner p {
    color: var(--pf-text-muted);
    font-size: 0.875rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--pf-border);
    border-top-color: var(--pf-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* login hint */
.login-hint {
    margin-top: 0.5rem;
}

.login-hint a {
    color: var(--pf-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.login-hint a:hover {
    color: var(--pf-text);
}

/* ===========================================
   Footer
   =========================================== */
.create-footer {
    background: var(--pf-bg);
    border-top: 1px solid var(--pf-border);
    padding: 1.25rem;
    text-align: center;
}

.footer-container {
    max-width: 960px;
    margin: 0 auto;
}

.create-footer p {
    color: #a3a3a3;
    font-size: 0.8125rem;
}

/* nav layout: logo | steps (centered) | actions */
body.plexiframes-create .nav-container,
body.plexiframes-customize .nav-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

body.plexiframes-create .nav-logo,
body.plexiframes-customize .nav-logo {
    justify-self: start;
}

body.plexiframes-create .nav-steps,
body.plexiframes-customize .nav-steps {
    justify-self: center;
}

body.plexiframes-create .nav-actions,
body.plexiframes-customize .nav-actions {
    justify-self: end;
}

@media (max-width: 768px) {
    body.plexiframes-create .nav-container,
    body.plexiframes-customize .nav-container {
        display: flex;
    }
}

/* ===========================================
   Guest Alert Banner
   =========================================== */
.guest-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.guest-alert-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.guest-alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #b45309;
}

.guest-alert-message {
    font-size: 0.875rem;
    color: #92400e;
    line-height: 1.4;
}

.guest-alert-message a {
    color: #b45309;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.guest-alert-message a:hover {
    color: #78350f;
}

.guest-alert-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #b45309;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.guest-alert-dismiss:hover {
    background: rgba(180, 83, 9, 0.15);
    color: #78350f;
}

.guest-alert-dismiss svg {
    width: 16px;
    height: 16px;
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
    .create-main {
        padding: 1.5rem 1rem;
    }

    .create-title {
        font-size: 1.75rem;
    }

    .upload-zone {
        padding: 2.5rem 1.5rem;
    }

    .upload-icon {
        width: 56px;
        height: 56px;
    }

    .upload-title {
        font-size: 1.25rem;
    }

    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.75rem;
    }

    .image-preview .remove-image {
        opacity: 1; /* always show on touch */
    }

    .plexi-preview-wrapper {
        height: 350px;
        border-radius: 12px;
    }

    .size-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.625rem;
    }

    .preset-label {
        min-width: 70px;
        font-size: 0.75rem;
    }

    .preset-chip {
        padding: 0.25rem 0.625rem;
        font-size: 0.75rem;
    }

    .btn-continue {
        width: 100%;
        justify-content: center;
    }

    .guest-alert {
        padding: 0.625rem 1rem;
    }

    .guest-alert-message {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .create-main {
        padding: 1.25rem 0.75rem;
    }

    .create-title {
        font-size: 1.375rem;
    }

    .create-subtitle {
        font-size: 0.875rem;
    }

    .upload-zone {
        padding: 2rem 1rem;
        border-radius: 12px;
    }

    .plexi-preview-wrapper {
        height: 300px;
        border-radius: 10px;
    }

    .scene-settings {
        padding: 0.625rem 0.75rem;
    }

    .preset-row {
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .preset-label {
        min-width: auto;
        width: 100%;
    }

    .images-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .image-preview {
        border-radius: 10px;
    }

    .btn-upload {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }

    .btn-continue {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
    }
}

@media (max-width: 360px) {
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .create-title {
        font-size: 1.25rem;
    }
}
