/* ── Print Quality Calculator ──────────────────────────── */
:root {
    --pq-bg: #fff;
    --pq-border: #cbd5e1;
    --pq-primary: #6366f1;
    --pq-primary-light: #e0e7ff;
    --pq-accent: #4f46e5;
}

.theme-dark {
    --pq-bg: #0f172a;
    --pq-border: #334155;
    --pq-primary: #6366f1;
    --pq-primary-light: rgba(99, 102, 241, 0.2);
    --pq-accent: #818cf8;
}

.pq-wrapper {
    width: 100%;
    max-width: 48rem;
    margin: 0 auto;
    padding: 0.75rem;
}

.pq-tool-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 12px 32px -16px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.theme-dark .pq-tool-card {
    background: #0f172a;
    border-color: #1e293b;
}

.pq-hidden {
    display: none;
}

/* Drop zone */
.pq-drop-zone {
    position: relative;
    cursor: pointer;
    border: 0;
    border-radius: 0;
    padding: 2rem 1.25rem;
    transition: border-color 0.3s, background 0.3s;
}

.pq-drop-zone:hover,
.pq-drop-zone.pq-drop-active {
    background: rgba(99, 102, 241, 0.04);
}
.pq-drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
}
.pq-upload-icon-wrap {
    width: 5rem;
    height: 5rem;
    background: var(--pq-primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pq-accent);
    transition: transform 0.3s;
}

.theme-dark .pq-upload-icon-wrap {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}
.pq-drop-zone:hover .pq-upload-icon-wrap {
    transform: scale(1.1);
}
.pq-drop-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.theme-dark .pq-drop-title {
    color: #f1f5f9;
}
.pq-drop-sub {
    color: #64748b;
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
}
.pq-drop-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(168,85,247,0.04));
    border-radius: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.pq-drop-zone:hover .pq-drop-overlay { opacity: 1; }

/* Results */
.pq-results {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1rem;
    animation: pq-fade-up 0.5s ease-out;
    min-width: 0;
}

.pq-results.pq-hidden {
    display: none;
}

@keyframes pq-fade-up {
    from {
        opacity: 0;
        transform: translateY(1.25rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* File card */
.pq-file-card {
    background: transparent;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 1rem;
    min-width: 0;
}

.theme-dark .pq-file-card {
    border-color: #1e293b;
}
.pq-file-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    min-width: 0;
}
.pq-preview-wrap {
    position: relative;
    width: 7rem;
    height: 7rem;
    flex-shrink: 0;
}
.pq-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 12px 28px -20px rgba(15, 23, 42, 0.7);
}
.pq-file-name {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.pq-file-info {
    min-width: 0;
    flex: 1;
}

.pq-file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.theme-dark .pq-file-name {
    color: #94a3b8;
}
.pq-replace-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
    padding: 0.625rem 0.9rem;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(238, 242, 255, 0.9), rgba(224, 231, 255, 0.8));
    color: #3730a3;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 8px 20px -16px rgba(67, 56, 202, 0.65);
    transition: transform 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}

.pq-replace-btn:hover {
    background: linear-gradient(180deg, rgba(224, 231, 255, 1), rgba(199, 210, 254, 0.92));
    border-color: rgba(99, 102, 241, 0.5);
    color: #312e81;
    transform: translateY(-1px);
}

.theme-dark .pq-replace-btn {
    background: linear-gradient(180deg, rgba(49, 46, 129, 0.32), rgba(30, 41, 59, 0.92));
    border-color: rgba(129, 140, 248, 0.45);
    color: #e0e7ff;
}

.theme-dark .pq-replace-btn:hover {
    background: linear-gradient(180deg, rgba(67, 56, 202, 0.35), rgba(30, 41, 59, 0.96));
    border-color: rgba(165, 180, 252, 0.6);
    color: #c7d2fe;
}

.pq-file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.pq-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #64748b;
}

/* Main grid */
.pq-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    min-width: 0;
}

@media (max-width: 640px) {
    .pq-main-grid { grid-template-columns: 1fr; }
}

/* Config panel */
.pq-config-panel {
    background: #f8fafc;
    border: 0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    min-width: 0;
}

.theme-dark .pq-config-panel {
    background: rgba(30, 41, 59, 0.5);
    border-color: var(--pq-border);
}
.pq-config-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 1rem;
}

.theme-dark .pq-config-label {
    color: #94a3b8;
}
.pq-slider {
    width: 100%;
    height: 0.5rem;
    background: #e2e8f0;
    border-radius: 0.5rem;
    appearance: none;
    cursor: pointer;
    accent-color: #6366f1;
    margin-bottom: 1rem;
}

.theme-dark .pq-slider {
    background: #334155;
}
.pq-dpi-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.pq-dpi-number {
    width: 6rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    padding: 0.4rem 0.5rem;
    outline: none;
}
.pq-dpi-number:focus { border-color: var(--pq-primary); }

.theme-dark .pq-dpi-number {
    background: #0f172a;
    border-color: var(--pq-border);
    color: #f1f5f9;
}
.pq-dpi-label {
    font-size: 0.875rem;
    color: #64748b;
}
.pq-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.pq-preset-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.pq-preset-btn:hover { background: #cbd5e1; }

.theme-dark .pq-preset-btn {
    background: #334155;
    color: #94a3b8;
}

.theme-dark .pq-preset-btn:hover {
    background: #475569;
}
.pq-preset-active {
    background: var(--pq-primary-light);
    color: #4338ca;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.theme-dark .pq-preset-active {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

/* Output panel – gradient */
.pq-output-panel {
    display: flex;
    min-width: 0;
}
.pq-output-gradient {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 0.75rem;
    padding: 1.25rem;
    color: #fff;
    box-shadow: 0 10px 40px -10px rgba(99,102,241,0.4);
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.pq-output-blur-bg {
    position: absolute;
    top: 0; right: 0;
    width: 8rem; height: 8rem;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    filter: blur(2rem);
    transform: translate(2rem, -2rem);
    pointer-events: none;
}
.pq-output-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(224,231,255,0.9);
    margin: 0 0 0.5rem;
    position: relative;
}
.pq-output-size {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.25rem;
    position: relative;
    line-height: 1.1;
    min-width: 0;
}
.pq-size-sep {
    font-size: 1.5rem;
    opacity: 0.5;
}
.pq-size-unit {
    font-size: 1.5rem;
}
.pq-output-inches {
    color: rgba(199, 210, 254, 0.8);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    position: relative;
}
.pq-quality-section {
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    position: relative;
}
.pq-quality-badge {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 700;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
    margin-bottom: 0.5rem;
}
.pq-badge-green {
    background: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.3);
}

.pq-badge-yellow {
    background: rgba(234, 179, 8, 0.25);
    box-shadow: 0 0 0 1px rgba(253, 224, 71, 0.3);
}

.pq-badge-red {
    background: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 0 1px rgba(252, 165, 165, 0.3);
}

.pq-badge-slate {
    background: rgba(100, 116, 139, 0.25);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.3);
}
.pq-quality-desc {
    font-size: 0.875rem;
    color: rgba(199,210,254,0.9);
    line-height: 1.4;
    margin: 0;
}

/* Formats */
.pq-formats-card {
    background: transparent;
    border: 0;
    border-top: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 0 0;
    min-width: 0;
}

.theme-dark .pq-formats-card {
    border-color: #1e293b;
}
.pq-formats-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: #0f172a;
    margin: 0 0 1rem;
}

.theme-dark .pq-formats-title {
    color: #f1f5f9;
}
.pq-formats-scroll {
    overflow-x: auto;
    max-width: 100%;
}
.pq-formats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 34rem;
}
.pq-formats-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    background: #f8fafc;
}

.theme-dark .pq-formats-table th {
    background: #1e293b;
    color: #94a3b8;
}
.pq-formats-row {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.pq-formats-row:hover {
    background: #f8fafc;
}

.theme-dark .pq-formats-row {
    border-color: #1e293b;
}

.theme-dark .pq-formats-row:hover {
    background: #1e293b;
}
.pq-td {
    padding: 0.75rem 1rem;
    color: #475569;
}

.theme-dark .pq-td {
    color: #94a3b8;
}
.pq-td-name {
    font-weight: 600;
    color: #0f172a;
}

.theme-dark .pq-td-name {
    color: #f1f5f9;
}
.pq-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.8rem;
}
.pq-status-ok  { color: #16a34a; }
.pq-status-no  { color: #d97706; }

.theme-dark .pq-status-ok {
    color: #4ade80;
}

.theme-dark .pq-status-no {
    color: #fbbf24;
}

@media (max-width: 640px) {
    .pq-wrapper {
        padding: 0.5rem;
    }

    .pq-results {
        padding: 0.875rem;
    }

    .pq-drop-zone {
        padding: 1.5rem 1rem;
    }

    .pq-file-left {
        flex-direction: column;
        align-items: stretch;
    }

    .pq-preview-wrap {
        width: 100%;
        max-width: 14rem;
        height: auto;
        aspect-ratio: 1;
        margin: 0 auto;
    }

    .pq-file-name {
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .pq-file-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pq-replace-btn {
        justify-content: center;
        width: 100%;
        white-space: normal;
    }

    .pq-file-meta {
        gap: 0.75rem;
    }

    .pq-dpi-row {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.75rem;
    }

    .pq-dpi-number {
        width: 100%;
    }

    .pq-output-gradient {
        padding: 1rem;
    }

    .pq-output-size {
        font-size: 1.9rem;
        gap: 0.35rem;
    }

    .pq-size-sep,
    .pq-size-unit {
        font-size: 1rem;
    }

    .pq-formats-card {
        padding: 1rem 0 0;
    }
}
