/* --- سانسوریار (Censoryar) Light Design System --- */
:root {
    /* Page & Surface Backgrounds */
    --bg-page: #f4f6fa;
    --bg-surface: #ffffff;
    --bg-surface-subtle: #f8fafc;
    --bg-surface-hover: #f1f5f9;
    --bg-input: #f1f5f9;
    --bg-viewer: #0f172a;
    
    /* Borders */
    --border-color: #e2e8f0;
    --border-subtle: #edf2f7;
    --border-focus: #f97316;
    
    /* Brand Colors (Extracted from Logo) */
    --brand-orange: #f97316;
    --brand-orange-hover: #ea580c;
    --brand-orange-light: rgba(249, 115, 22, 0.08);
    --brand-orange-border: rgba(249, 115, 22, 0.25);
    --brand-gradient: linear-gradient(135deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
    --brand-gradient-hover: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    
    --brand-navy: #1e293b;
    --brand-navy-light: #334155;
    
    --accent-blue: #0284c7;
    --success: #059669;
    --success-light: rgba(5, 150, 105, 0.1);
    --danger: #e11d48;
    
    /* Text Typography */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    
    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-card: 0 4px 20px -2px rgba(30, 41, 59, 0.06), 0 2px 6px -1px rgba(30, 41, 59, 0.04);
    --shadow-card-hover: 0 10px 25px -3px rgba(30, 41, 59, 0.09), 0 4px 10px -2px rgba(30, 41, 59, 0.05);
    --shadow-orange: 0 4px 14px rgba(249, 115, 22, 0.35);
    --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.12);
    
    --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background: linear-gradient(180deg, #f8fafd 0%, #edf1f7 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(249, 115, 22, 0.2);
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-text h1 {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--brand-navy);
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    align-items: center;
    background-color: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    gap: 0.25rem;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1.15rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.6);
}

.nav-tab.active {
    background-color: #ffffff;
    color: var(--brand-orange);
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
    padding: 0.4rem 0.95rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(5, 150, 105, 0.5);
}

/* Main Workspace */
.main-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    flex: 1;
    width: 100%;
}

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

/* Sidebar Controls Panel */
.control-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    height: fit-content;
    box-shadow: var(--shadow-card);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.85rem;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.control-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.label-with-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.value-badge {
    font-size: 0.75rem;
    background-color: var(--brand-orange-light);
    border: 1px solid var(--brand-orange-border);
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--brand-orange);
    font-weight: 800;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background-color: var(--bg-input);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    gap: 0.25rem;
}

.segment-option {
    flex: 1;
    cursor: pointer;
}

.segment-option input {
    display: none;
}

.segment-pill {
    display: block;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.45rem 0.25rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.segment-option input:checked + .segment-pill {
    background-color: #ffffff;
    color: var(--brand-orange);
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Checkbox List */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.checkbox-item:hover {
    background-color: #ffffff;
    border-color: var(--brand-orange-border);
    box-shadow: var(--shadow-sm);
}

.checkbox-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-custom {
    width: 19px;
    height: 19px;
    min-width: 19px;
    border: 2px solid #cbd5e1;
    border-radius: 5px;
    margin-top: 1px;
    display: inline-block;
    position: relative;
    transition: all 0.2s ease;
    background: #fff;
}

.checkbox-item input:checked ~ .checkbox-custom {
    background-color: var(--brand-orange);
    border-color: var(--brand-orange);
}

.checkbox-item input:checked ~ .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2.2px 2.2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.checkbox-text strong {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 700;
}

.checkbox-text small {
    font-size: 0.73rem;
    color: var(--text-muted);
}

/* Range Inputs */
.custom-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    outline: none;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand-orange);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
    border: 2.5px solid #fff;
    transition: transform 0.15s ease;
}

.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.range-subtext {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Privacy & Info Card */
.info-card {
    background-color: #fff9f5;
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-md);
    padding: 0.95rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.info-icon {
    color: var(--brand-orange);
    margin-top: 2px;
}

.info-text strong {
    display: block;
    font-size: 0.82rem;
    color: #9a3412;
    margin-bottom: 0.25rem;
    font-weight: 800;
}

.info-text p {
    font-size: 0.74rem;
    color: #7c2d12;
    line-height: 1.45;
}

/* Viewer Section */
.viewer-section {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    min-height: 560px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
}

.tab-pane {
    display: none;
    width: 100%;
    flex: 1;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--brand-orange);
    background: #fff9f5;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    max-width: 500px;
}

.upload-icon-circle {
    width: 76px;
    height: 76px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-orange);
    box-shadow: var(--shadow-sm);
}

.drop-zone-content h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.drop-zone-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sample-images-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.btn-sample {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-sample:hover {
    color: var(--brand-orange);
    border-color: var(--brand-orange);
    background-color: var(--brand-orange-light);
}

.file-input-hidden {
    display: none;
}

/* Result View */
.result-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.result-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.meta-item span {
    font-weight: 800;
    color: var(--text-primary);
}

.result-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost, .btn-ghost-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: var(--shadow-orange);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-gradient-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: #cbd5e1;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

.btn-ghost-sm {
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost-sm:hover {
    color: var(--brand-orange);
}

/* Comparison Slider */
.slider-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 1rem;
    min-height: 440px;
    position: relative;
    user-select: none;
}

.comparison-container {
    position: relative;
    max-width: 100%;
    max-height: 580px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: inline-block;
    cursor: ew-resize;
}

.comparison-img {
    display: block;
    max-width: 100%;
    max-height: 540px;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

.clipped-image-layer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    pointer-events: none;
}

.clipped-image-layer img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
}

.handle-line {
    width: 2.5px;
    height: 100%;
    background-color: var(--brand-orange);
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.8);
}

.handle-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background-color: #ffffff;
    color: var(--brand-orange);
    border: 2px solid var(--brand-orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.badge-label {
    position: absolute;
    top: 12px;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: var(--radius-sm);
    z-index: 5;
    pointer-events: none;
}

.badge-original {
    right: 12px;
    background-color: rgba(15, 23, 42, 0.8);
    color: #fff;
}

.badge-censored {
    left: 12px;
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}

.slider-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Loading Overlay */
.processing-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    z-index: 40;
}

.spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

.pulse-spinner {
    width: 52px;
    height: 52px;
    border: 3.5px solid #fed7aa;
    border-top-color: var(--brand-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Batch Processing Tab */
.batch-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

.batch-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface-subtle);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.batch-dropzone:hover {
    border-color: var(--brand-orange);
    background-color: #fff9f5;
}

.batch-dropzone-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 700px;
    margin: 0 auto;
    gap: 1.5rem;
}

.batch-icon {
    color: var(--brand-orange);
}

.batch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.batch-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batch-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.batch-progress-bar {
    height: 100%;
    background: var(--brand-gradient);
    transition: width 0.3s ease;
}

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

.batch-item-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.batch-thumb-wrap {
    height: 140px;
    background-color: #0f172a;
    position: relative;
    overflow: hidden;
}

.batch-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.batch-status-tag {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

.batch-status-pending { background: rgba(100, 116, 139, 0.85); color: #fff; }
.batch-status-processing { background: rgba(249, 115, 22, 0.9); color: #fff; }
.batch-status-done { background: rgba(5, 150, 105, 0.9); color: #fff; }
.batch-status-error { background: rgba(225, 29, 72, 0.9); color: #fff; }

.batch-info {
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.batch-filename {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Footer */
.app-footer {
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-brand {
    font-weight: 900;
    color: var(--brand-navy);
    font-size: 1rem;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.15s ease;
}

.footer-link:hover {
    color: var(--brand-orange);
}

.footer-link.highlight {
    background-color: var(--brand-orange-light);
    border: 1px solid var(--brand-orange-border);
    color: var(--brand-orange);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.footer-link.highlight:hover {
    background-color: var(--brand-orange);
    color: #fff;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--brand-navy);
    color: #fff;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hidden {
    display: none !important;
}
