/* ============================================
   SetPDF Pro — Premium Neomorphic + Glassmorphism
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    /* Single Blue Theme */
    --bg-color: #c5d0e6;
    --text-main: #1a2540;
    --text-muted: #46567c;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --shadow-light: #dae3f2;
    --shadow-dark: #a0abc4;
    --glass-bg: rgba(165, 182, 215, 0.4);
    --glass-border: rgba(185, 200, 228, 0.45);
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;

    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --transition: cubic-bezier(0.4, 0, 0.2, 1) 0.35s;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --shadow-light: #1e293b;
    --shadow-dark: #020617;
    --glass-bg: rgba(15, 23, 42, 0.5);
    --glass-border: rgba(51, 65, 85, 0.4);
    --primary: #60a5fa;
    --primary-glow: rgba(96, 165, 250, 0.35);
}

/* ============ Reset ============ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition), color var(--transition);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ============ Neomorphic Mixins ============ */
.neo-flat {
    background: var(--bg-color);
    box-shadow: 8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);
}

.neo-inset {
    background: var(--bg-color);
    box-shadow: inset 5px 5px 10px var(--shadow-dark),
        inset -5px -5px 10px var(--shadow-light);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
}

/* ============ Buttons ============ */
button {
    border: none;
    cursor: pointer;
    outline: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-color);
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px var(--primary-glow);
    transition: transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
    box-shadow: 0 6px 28px var(--primary-glow);
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-neo {
    background: var(--bg-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    transition: all 0.15s ease;
}

.btn-neo:active {
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

/* ============ Layout ============ */
.app-shell {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem 1.25rem 2rem;
    flex-grow: 1;
}

/* ============ Header / Nav ============ */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ============ Drop Zone ============ */
.drop-zone {
    height: 260px;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2.5px dashed var(--shadow-dark);
    margin-bottom: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    gap: 6px;
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
    transform: scale(1.005);
}

.drop-zone .upload-icon {
    color: var(--primary);
    opacity: 0.6;
    margin-bottom: 0.75rem;
}

.drop-zone h3 {
    font-weight: 700;
    font-size: 1.25rem;
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============ Workspace Grid ============ */
.workspace {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
}

/* ============ Preview Pane ============ */
.preview-pane {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-header h3 {
    font-weight: 700;
    font-size: 1.05rem;
}

.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.25rem;
    min-height: 100px;
}

.img-card {
    border-radius: var(--radius-lg);
    padding: 10px;
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.img-card:hover {
    transform: translateY(-4px);
}

.img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius-lg) - 6px);
    background: rgba(0, 0, 0, 0.05);
    display: block;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.55) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.25s;
    backdrop-filter: blur(2px);
    border-radius: var(--radius-lg);
}

.img-card:hover .card-overlay {
    opacity: 1;
}

.overlay-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.15s;
    border: 1px solid var(--glass-border);
}

.overlay-btn:hover {
    background: var(--primary);
    color: var(--bg-color);
}

/* ============ Options Sidebar ============ */
.options-pane {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.opt-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.opt-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.input-group {
    margin-bottom: 0.9rem;
}

.input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: var(--bg-color);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    transition: box-shadow 0.2s;
}

input:focus,
select:focus {
    outline: none;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light),
        0 0 0 2px var(--primary-glow);
}

.range-slider {
    width: 100%;
    height: 6px;
    background: var(--shadow-dark);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    margin-top: 4px;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 8px var(--primary-glow);
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.checkbox-row input[type="checkbox"] {
    accent-color: var(--primary);
}

/* ============ Editor Modal ============ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-content {
    width: 100%;
    max-width: 960px;
    max-height: 92vh;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.contact-popup {
    width: 100%;
    max-width: 380px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        transform: scale(0.85);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.editor-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.editor-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.editor-body {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 260px;
    overflow: hidden;
}

.canvas-area {
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
}

.canvas-area img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
}

.editor-tools {
    padding: 1.25rem;
    overflow-y: auto;
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ============ Progress Modal ============ */
.progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.progress-card {
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 420px;
    text-align: center;
}

.progress-track {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #ec4899);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* ============ Toasts ============ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 22px;
    border-radius: var(--radius-md);
    color: var(--bg-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    animation: toastIn 0.35s ease forwards;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

.toast.success {
    background: var(--accent-success);
}

.toast.error {
    background: var(--accent-danger);
}

.toast.info {
    background: var(--primary);
}

@keyframes toastIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============ Loader ============ */
.loader-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--shadow-dark);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ============ Utilities ============ */
.hidden {
    display: none !important;
}

.est-label {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .editor-body {
        grid-template-columns: 1fr;
    }

    .editor-tools {
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }

    .img-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 500px) {
    nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .img-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .drop-zone {
        height: 200px;
    }
}