/**
 * PorikkhaDaw AI Photo Resizer & Form Optimizer - Modern Pro UI Theme
 * High-precision application photo and signature optimizer
 */

:root {
    --pr-primary: #7c3aed;
    --pr-primary-hover: #6d28d9;
    --pr-primary-light: #f5f3ff;
    --pr-secondary: #06b6d4;
    --pr-accent-grad: linear-gradient(135deg, #7c3aed 0%, #7c3aed 50%, #06b6d4 100%);
    --pr-accent-glow: 0 12px 32px -4px rgba(124, 58, 237, 0.28);
    --pr-bg-surface: #ffffff;
    --pr-bg-subtle: #f8fafc;
    --pr-border: #e2e8f0;
    --pr-border-focus: #a78bfa;
    --pr-text-main: #0f172a;
    --pr-text-muted: #64748b;
    --pr-radius-xl: 1.25rem;
    --pr-radius-lg: 0.85rem;
    --pr-radius-md: 0.6rem;
    --pr-shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --pr-shadow-hover: 0 20px 35px -8px rgba(15, 23, 42, 0.12), 0 10px 15px -5px rgba(15, 23, 42, 0.06);
}

/* ─── Hero Section ─── */
.pr-hero {
    background: linear-gradient(135deg, #2e1065 0%, #4c1d95 40%, #6d28d9 100%);
    border-radius: var(--pr-radius-xl);
    padding: 2.75rem 2.25rem 2.25rem;
    color: #ffffff;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px -15px rgba(46, 16, 101, 0.4);
}

.pr-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.25) 0%, rgba(124, 58, 237, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.pr-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--pr-accent-grad);
}

.pr-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.pr-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.45rem 1rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #a5f3fc;
}

.pr-hero-title {
    font-size: 2.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.pr-grad {
    background: linear-gradient(135deg, #a5f3fc 0%, #38bdf8 50%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pr-hero-desc {
    color: #ddd6fe;
    font-size: 1.05rem;
    max-width: 760px;
    line-height: 1.6;
    margin-bottom: 1.75rem;
    position: relative;
    z-index: 1;
}

/* Workflow Step Track */
.pr-steps {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.65rem 1.25rem;
    border-radius: 9999px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.pr-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #ede9fe;
}

.pr-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #06b6d4;
    color: #082f49;
    font-weight: 800;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pr-step-arrow {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
}

/* ─── Section Cards & Preset Picker ─── */
.pr-section-card {
    background: #ffffff;
    border: 1px solid var(--pr-border);
    border-radius: var(--pr-radius-xl);
    padding: 1.75rem;
    box-shadow: var(--pr-shadow-card);
    margin-bottom: 1.5rem;
    position: relative;
}

.pr-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pr-section-title {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--pr-text-main);
    margin: 0;
    letter-spacing: -0.02em;
}

.pr-section-sub {
    color: var(--pr-text-muted);
    font-size: 0.9rem;
    margin: 0.25rem 0 0;
}

/* Preset Cards Grid */
.pr-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.pr-preset-card {
    text-align: left;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.4rem;
    border: 2px solid var(--pr-border);
    border-radius: var(--pr-radius-lg);
    background: var(--pr-bg-subtle);
    color: var(--pr-text-main);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.pr-preset-card:hover {
    border-color: var(--pr-border-focus);
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.12);
}

.pr-preset-card.active {
    border-color: var(--pr-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2), 0 10px 25px -5px rgba(124, 58, 237, 0.15);
}

.pr-preset-card.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--pr-accent-grad);
}

.pr-preset-ico {
    font-size: 1.4rem;
    color: var(--pr-primary);
    margin-bottom: 0.65rem;
    width: 42px;
    height: 42px;
    border-radius: var(--pr-radius-md);
    background: var(--pr-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pr-preset-name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--pr-text-main);
    margin-bottom: 0.2rem;
}

.pr-preset-meta {
    color: var(--pr-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

/* ─── Upload Dropzone ─── */
.pr-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--pr-radius-xl);
    background: #ffffff;
    padding: 3.75rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1.5rem;
    box-shadow: var(--pr-shadow-card);
}

.pr-upload-zone:hover, .pr-upload-zone.pr-dragover {
    border-color: var(--pr-primary);
    background: #fafafa;
    transform: translateY(-2px);
    box-shadow: var(--pr-shadow-hover);
}

.pr-upload-ico {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: var(--pr-accent-grad);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    box-shadow: var(--pr-accent-glow);
    animation: prFloat 3.5s ease-in-out infinite;
}

@keyframes prFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

.pr-upload-title {
    font-weight: 800;
    font-size: 1.45rem;
    color: var(--pr-text-main);
    margin-bottom: 0.35rem;
}

.pr-upload-sub {
    color: var(--pr-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.pr-upload-note {
    color: var(--pr-text-muted);
    font-size: 0.82rem;
    margin-top: 1.25rem;
}

/* ─── Editor Workspace ─── */
.pr-editor {
    margin-bottom: 1.5rem;
}

.pr-file-chip {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.85rem;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--pr-border);
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.pr-file-meta {
    color: var(--pr-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.pr-badge {
    background: #0f172a;
    color: #f1f5f9;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.45rem 0.95rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pr-note {
    background: #eff6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
    border-radius: var(--pr-radius-md);
    padding: 0.65rem 0.95rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.pr-note-warn {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

/* Crop Stage Viewport */
.pr-stage-wrap {
    background: #ffffff;
    border: 1px solid var(--pr-border);
    border-radius: var(--pr-radius-xl);
    padding: 1rem;
    box-shadow: var(--pr-shadow-card);
}

.pr-crop-stage {
    position: relative;
    height: clamp(340px, 55vh, 560px);
    border-radius: var(--pr-radius-lg);
    overflow: hidden;
    touch-action: none;
    background-color: #0f172a;
    background-image: 
        linear-gradient(45deg, #1e293b 25%, transparent 25%), 
        linear-gradient(-45deg, #1e293b 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #1e293b 75%), 
        linear-gradient(-45deg, transparent 75%, #1e293b 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    cursor: grab;
    border: 1px solid var(--pr-border);
}

.pr-crop-stage:active {
    cursor: grabbing;
}

#prCropImg {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none;
    max-height: none;
    user-select: none;
    -webkit-user-drag: none;
    will-change: left, top, width, height;
    display: block;
}

#prShade {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.pr-shade-piece {
    position: absolute;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(2px);
    display: none;
}

.pr-shade-west, .pr-shade-east {
    right: auto;
}

.pr-crop-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.5), 0 0 20px rgba(0, 0, 0, 0.4);
    background: transparent;
    border-radius: 4px;
    z-index: 3;
}

.pr-crop-frame::before, .pr-crop-frame::after {
    content: '';
    position: absolute;
    border-color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

.pr-hint {
    color: var(--pr-text-muted);
    font-size: 0.84rem;
    margin: 0.75rem 0.25rem 0;
    line-height: 1.5;
}

/* Sidebar Controls */
.pr-side {
    background: #ffffff;
    border: 1px solid var(--pr-border);
    border-radius: var(--pr-radius-xl);
    padding: 1.4rem;
    box-shadow: var(--pr-shadow-card);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pr-group-label {
    display: block;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--pr-text-main);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pr-swatch {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--pr-radius-md);
    border: 2px solid var(--pr-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pr-swatch:hover {
    transform: scale(1.1);
}

.pr-swatch.active {
    border-color: var(--pr-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
    transform: scale(1.08);
}

.pr-run {
    background: var(--pr-accent-grad);
    border: none;
    color: #ffffff;
    font-weight: 800;
    font-size: 1rem;
    padding: 0.95rem 1.5rem;
    border-radius: var(--pr-radius-lg);
    box-shadow: var(--pr-accent-glow);
    cursor: pointer;
    transition: all 0.25s ease;
}

.pr-run:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 16px 36px -4px rgba(124, 58, 237, 0.4);
    color: #ffffff;
}

.pr-run-note {
    color: var(--pr-text-muted);
    font-size: 0.8rem;
    margin: 0.5rem 0 0;
    line-height: 1.5;
    text-align: center;
}

/* Loading Overlay */
.pr-busy {
    position: fixed;
    inset: 0;
    z-index: 2050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.pr-busy-card {
    background: #ffffff;
    border-radius: var(--pr-radius-xl);
    padding: 2.25rem 3rem;
    text-align: center;
    color: var(--pr-text-main);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

/* ─── Result Comparison Section ─── */
.pr-result {
    margin-top: 2rem;
    margin-bottom: 2rem;
    scroll-margin-top: 1rem;
}

.pr-result-title {
    font-weight: 800;
    color: var(--pr-text-main);
    margin-bottom: 1rem;
    font-size: 1.35rem;
}

.pr-result-card {
    background: #ffffff;
    border: 1px solid var(--pr-border);
    border-radius: var(--pr-radius-xl);
    padding: 1.75rem;
    box-shadow: var(--pr-shadow-card);
}

.pr-cmp {
    position: relative;
    overflow: hidden;
    border-radius: var(--pr-radius-lg);
    border: 1px solid var(--pr-border);
    background: #0f172a;
    max-width: 100%;
    aspect-ratio: 1;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.pr-cmp img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

#prBeforeImg { z-index: 1; }
#prAfterImg { z-index: 2; }

.pr-slider {
    margin-top: 1rem;
}

.pr-result-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.pr-chip {
    background: var(--pr-bg-subtle);
    border: 1px solid var(--pr-border);
    border-radius: var(--pr-radius-md);
    padding: 0.75rem 0.85rem;
    text-align: center;
}

.pr-chip-label {
    display: block;
    color: var(--pr-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.pr-chip strong {
    font-size: 1.05rem;
    color: var(--pr-text-main);
}

.pr-status {
    font-weight: 700;
    font-size: 0.92rem;
    padding: 0.65rem 1rem;
    border-radius: var(--pr-radius-md);
    line-height: 1.5;
}

.pr-status-ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.pr-status-bad {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.pr-download {
    border-radius: var(--pr-radius-lg);
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 10px 25px -4px rgba(16, 185, 129, 0.35);
    transition: all 0.25s ease;
}

.pr-download:hover {
    background: #059669;
    border-color: #059669;
    transform: scale(1.02);
    box-shadow: 0 16px 32px -4px rgba(16, 185, 129, 0.45);
}

.pr-token-note {
    color: var(--pr-text-muted);
    font-size: 0.84rem;
    margin: 0.75rem 0 0;
}

/* Feature Fact Cards */
.pr-fact {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.5rem;
}

.pr-fact-ico {
    color: var(--pr-primary);
    font-size: 1.75rem;
    margin-top: 0.15rem;
}

.pr-fact strong {
    color: var(--pr-text-main);
    font-size: 1rem;
}

@media (max-width: 768px) {
    .pr-preset-grid { grid-template-columns: 1fr; }
    .pr-crop-stage { height: clamp(300px, 60vh, 440px); }
    .pr-result-chips { grid-template-columns: 1fr; }
    .pr-hero-title { font-size: 1.75rem; }
    .pr-hero { padding: 2rem 1.5rem; }
}