/* ==============================================================================
   PRIVACY REDACTOR - MODERN CSS DESIGN SYSTEM
   Dark-themed, glassmorphic, responsive & accessible
   ============================================================================== */

:root {
    --bg-base: #0b0f19;
    --bg-surface: #121826;
    --bg-surface-elevated: #1a2234;
    --bg-glass: rgba(26, 34, 52, 0.75);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: #3b82f6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.25);
    
    --success: #10b981;
    --success-hover: #059669;
    --success-glow: rgba(16, 185, 129, 0.25);
    
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --tag-ahv: #10b981;
    --tag-email: #3b82f6;
    --tag-phone: #8b5cf6;
    --tag-name: #ec4899;
    --tag-address: #f59e0b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Base Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1.5rem;
}

/* ==============================================================================
   HEADER
   ============================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tagline {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Buttons */
.btn-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-normal);
    text-decoration: none;
}

.btn-large {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 14px var(--success-glow);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--success-glow);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    transition: var(--transition-fast);
}

.btn-link:hover {
    color: var(--text-primary);
}

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

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ==============================================================================
   CONFIG PANEL (COLLAPSIBLE)
   ============================================================================== */
.config-panel {
    display: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    animation: slideDown 0.25s ease-out;
}

.config-panel.open {
    display: block;
}

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

.config-header {
    margin-bottom: 1rem;
}

.config-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.config-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.85rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.config-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.test-result {
    font-size: 0.85rem;
    font-weight: 500;
}

.test-result.success { color: var(--success); }
.test-result.error { color: var(--danger); }

/* ==============================================================================
   NAVIGATION TABS
   ============================================================================== */
.tab-nav {
    display: flex;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.5rem;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

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

.tab-btn.active {
    color: #fff;
    background: var(--bg-surface-elevated);
    box-shadow: var(--shadow-sm);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.55rem;
    left: 10%;
    width: 80%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.tab-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.ocr-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    font-weight: 600;
}

/* ==============================================================================
   TAB 1: WORKSPACE (SPLIT PANE)
   ============================================================================== */
.workspace-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .workspace-split {
        grid-template-columns: 1fr;
    }
}

.pane {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-subtle);
}

.pane-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.pane-title h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.badge-subtle {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.badge-highlight {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.editor-wrapper {
    flex: 1;
    min-height: 400px;
    display: flex;
}

.text-editor {
    width: 100%;
    min-height: 400px;
    max-height: 550px;
    padding: 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    overflow-y: auto;
}

.output-viewer {
    white-space: pre-wrap;
    word-break: break-word;
}

.output-placeholder {
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.pane-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-subtle);
}

.editor-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.copy-toolbar {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* Tag Highlights in Output */
.redact-tag {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0 1px;
}

.tag-ahv {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.tag-email {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.tag-tel {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.5);
}

.tag-name {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.5);
}

.tag-adresse {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.5);
}

/* Stats Summary */
.stats-summary {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.stat-pill {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 500;
}

.stats-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==============================================================================
   TAB 2: FILE WORKSPACE & DROPZONE
   ============================================================================== */
.file-workspace {
    margin-bottom: 2rem;
}

.dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    padding: 3.5rem 2rem;
    background: rgba(18, 24, 38, 0.6);
    cursor: pointer;
    text-align: center;
    transition: var(--transition-normal);
    position: relative;
}

.dropzone:hover, .dropzone.drag-active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.15);
}

.file-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.dropzone-icon {
    color: var(--primary);
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

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

.dropzone-content h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dropzone-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.supported-formats {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.format-tag {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.ocr-feature-callout {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 750px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.25rem;
    color: #a7f3d0;
    font-size: 0.85rem;
    text-align: left;
    margin-top: 0.5rem;
}

.ocr-feature-callout svg {
    flex-shrink: 0;
    color: var(--success);
}

/* File Card */
.file-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.25s ease-out;
}

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

.file-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-type-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

.file-details h4 {
    font-size: 1.05rem;
    font-weight: 600;
}

.file-details span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-progress-container {
    margin: 1.25rem 0;
}

.progress-bar-wrapper {
    height: 8px;
    background: var(--bg-surface-elevated);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.progress-bar.animated {
    width: 100%;
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

.file-card-actions {
    display: flex;
    justify-content: flex-end;
}

.file-success-box {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
}

.success-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.success-text {
    flex: 1;
}

.success-text h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #a7f3d0;
}

.success-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ==============================================================================
   FOOTER
   ============================================================================== */
.app-footer {
    margin-top: auto;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==============================================================================
   TOAST NOTIFICATIONS
   ============================================================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.toast-success {
    border-color: rgba(16, 185, 129, 0.5);
    background: #064e3b;
    color: #ecfdf5;
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, 0.5);
    background: #7f1d1d;
    color: #fef2f2;
}

@keyframes toastIn {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
