:root {
    /* DoIT Consulting Color Palette */
    --doit-dark: #1a2a3a;
    --doit-blue: #2b579a;
    --doit-light-blue: #5b9bd5;
    --doit-accent: #0078d4;
    
    /* App Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Functional Colors */
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-bg: #eff6ff;
    --success: #059669;
    --success-light: #10b981;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-light: #ef4444;
    --error-bg: #fef2f2;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    
    /* Mode Colors */
    --word-color: #2b579a;
    --word-bg: #e8f0fe;
    --pdf-color: #dc2626;
    --pdf-bg: #fef2f2;
    --ocr-color: #d97706;
    --ocr-bg: #fffbeb;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    min-height: 100vh;
    background: var(--bg-primary);
    font-family: var(--font-sans);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(43, 87, 154, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(91, 155, 213, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Header */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 24px;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.app-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.title-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--doit-blue), var(--doit-light-blue));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.title-icon svg {
    width: 28px;
    height: 28px;
}

.app-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Main Content */
.app-main {
    flex: 1;
    padding: 32px 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mode-btn:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.mode-btn.active {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.mode-btn.active[data-mode="word-to-pdf"] {
    border-color: var(--word-color);
    background: var(--word-bg);
}

.mode-btn.active[data-mode="pdf-to-word"] {
    border-color: var(--pdf-color);
    background: var(--pdf-bg);
}

.mode-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mode-icon.word {
    background: var(--word-color);
    color: white;
}

.mode-icon.pdf {
    background: var(--pdf-color);
    color: white;
}

.mode-icon svg {
    width: 22px;
    height: 22px;
}

.mode-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-label {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

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

/* Dropzone */
.dropzone {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.dropzone:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-bg);
    border-style: solid;
    transform: scale(1.01);
}

body.pdf-mode .dropzone:hover,
body.pdf-mode .dropzone.dragover {
    border-color: var(--pdf-color);
    background: var(--pdf-bg);
}

.dropzone-inner {
    padding: 48px 32px;
}

.dropzone-content {
    text-align: center;
}

.upload-visual {
    margin-bottom: 20px;
}

.upload-circle {
    width: 72px;
    height: 72px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: var(--accent);
    transition: all 0.2s ease;
}

.dropzone:hover .upload-circle {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

body.pdf-mode .dropzone:hover .upload-circle {
    background: var(--pdf-color);
}

.upload-circle svg {
    width: 32px;
    height: 32px;
}

.dropzone h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.dropzone-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.formats-list {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.format-tag {
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Page Selector Panel */
.page-selector-panel {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.page-selector-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.page-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.pdf-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.pdf-info svg {
    width: 20px;
    height: 20px;
    color: var(--pdf-color);
}

.pdf-filename {
    font-weight: 500;
    font-size: 0.875rem;
}

.btn-cancel {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: var(--error-bg);
    color: var(--error);
}

.btn-cancel svg {
    width: 18px;
    height: 18px;
}

.page-selector-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.selection-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.selection-actions {
    display: flex;
    gap: 8px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.btn-text:hover {
    background: var(--accent-bg);
}

/* Pages Grid */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.page-item {
    position: relative;
    cursor: pointer;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
}

.page-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.page-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.page-thumbnail {
    width: 100%;
    aspect-ratio: 210 / 297;
    object-fit: cover;
    display: block;
}

.page-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

.page-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.page-item.selected .page-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.page-checkbox svg {
    width: 14px;
    height: 14px;
    color: white;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.page-item.selected .page-checkbox svg {
    opacity: 1;
}

/* Page Selector Footer */
.page-selector-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.ocr-option-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label input {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--ocr-color);
    border-color: var(--ocr-color);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.lang-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* Progress Panel */
.progress-panel {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
}

.progress-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.progress-file {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.file-icon-wrapper {
    width: 36px;
    height: 36px;
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.file-icon-wrapper svg {
    width: 20px;
    height: 20px;
}

.file-name {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.progress-track {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 4px;
    transition: width 0.3s ease;
}

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

/* Result Panel */
.result-panel {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 0 0 4px var(--success-bg);
}

.result-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.success-check {
    width: 64px;
    height: 64px;
    background: var(--success-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--success);
}

.success-check svg {
    width: 32px;
    height: 32px;
}

.result-panel h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.meta-duration {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.meta-badge {
    display: none;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.meta-badge.ocr {
    display: inline-block;
    background: var(--ocr-bg);
    color: var(--ocr-color);
}

.meta-badge.pdf2docx {
    display: inline-block;
    background: var(--accent-bg);
    color: var(--accent);
}

.meta-badge.libreoffice {
    display: inline-block;
    background: var(--success-bg);
    color: var(--success);
}

.meta-pages {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    background: var(--success);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.download-button:hover {
    background: var(--success-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.download-button svg {
    width: 20px;
    height: 20px;
}

.btn-secondary {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Error Panel */
.error-panel {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--error);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 0 0 4px var(--error-bg);
}

.error-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.error-icon {
    width: 64px;
    height: 64px;
    background: var(--error-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--error);
}

.error-icon svg {
    width: 32px;
    height: 32px;
}

.error-panel h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.error-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-error {
    display: inline-flex;
    background: var(--error);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-error:hover {
    background: var(--error-light);
}

/* Footer */
.app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px;
    margin-top: auto;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.info-item svg {
    width: 14px;
    height: 14px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    justify-content: center;
}

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

.brand-logo {
    height: 56px;
    width: auto;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .app-main {
        padding: 24px 16px;
    }
    
    .mode-selector {
        grid-template-columns: 1fr;
    }
    
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .page-selector-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}
