/* ======================
   ADVANCED DOCUMENT CONVERTER STYLES
   ====================== */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --warning-color: #f97316;
    --success-color: #22c55e;
    --info-color: #06b6d4;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.tool-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ======================
   PROFESSIONAL HEADER
   ====================== */
.tool-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255,255,255,0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-text h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header-text h1 i {
    margin-right: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255,255,255,0.7);
    border-radius: var(--radius-lg);
    min-width: 100px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ======================
   TEMPLATE SECTION
   ====================== */
.template-section {
    margin-bottom: 2rem;
}

.template-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-section h2 i {
    color: var(--accent-color);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.template-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.28s cubic-bezier(.2,.9,.2,1), box-shadow 0.28s ease, background 0.28s ease;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: var(--shadow-md);
    will-change: transform, box-shadow;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    background: rgba(255,255,255,1);
}

/* Selected / active template visual state (controlled by JS) */
.template-card.selected {
    border-color: var(--primary-dark);
    background: linear-gradient(90deg, rgba(99,102,241,0.06), rgba(16,185,129,0.03));
    box-shadow: 0 12px 30px rgba(79,70,229,0.10);
    transform: translateY(-8px) scale(1.02);
}

/* Keyboard focus-visible for template cards */
.template-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12), 0 8px 20px rgba(79,70,229,0.08);
    border-color: var(--primary-color);
}

.template-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.template-icon .fa-arrow-right {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.template-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.template-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.template-stats {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success-color);
    background: rgba(34, 197, 94, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* ======================
   CONVERTER LAYOUT
   ====================== */
.converter-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

.converter-container {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
}

/* ======================
   TAB NAVIGATION
   ====================== */
.tab-navigation {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.5);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn i {
    font-size: 1.1rem;
}

/* ======================
   TAB CONTENT
   ====================== */
.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

/* ======================
   UPLOAD ZONE
   ====================== */
.upload-zone {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    background: var(--bg-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 2rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-zone h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-zone p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.supported-formats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.format-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ======================
   FILE PREVIEW
   ====================== */
.file-preview {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 2rem;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.file-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.separator {
    color: var(--text-muted);
}

.remove-file-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* ======================
   CONVERSION PANEL
   ====================== */
.conversion-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.conversion-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option-group label {
    min-width: 120px;
    font-weight: 600;
    color: var(--text-primary);
}

.option-group select {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
}

.quality-selector {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.quality-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.quality-btn:hover,
.quality-btn.active {
    background: var(--primary-color);
    color: white;
}

.conversion-settings {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.checkbox-item:hover {
    background: var(--bg-primary);
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.label-text {
    font-weight: 500;
    color: var(--text-primary);
}

/* ======================
   CONVERSION PREVIEW
   ====================== */
.conversion-preview {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.preview-header {
    text-align: center;
    margin-bottom: 2rem;
}

.preview-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.format-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.format-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.format-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.format-icon.original {
    background: linear-gradient(135deg, var(--text-secondary), var(--text-muted));
}

.format-icon.target {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.conversion-arrow {
    font-size: 2rem;
    color: var(--primary-color);
}

.preview-stats {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex: 1;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ======================
   ACTION BUTTONS
   ====================== */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.preview-btn,
.convert-btn,
.reset-btn,
.batch-convert-btn,
.save-preset-btn,
.reset-settings-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.convert-btn,
.batch-convert-btn {
    background: linear-gradient(135deg, var(--success-color), #16a34a);
    color: white;
}

.convert-btn:hover,
.batch-convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.preview-btn {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.preview-btn:hover {
    background: var(--primary-color);
    color: white;
}

.reset-btn {
    background: var(--bg-primary);
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

.reset-btn:hover {
    background: var(--danger-color);
    color: white;
}

.save-preset-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.save-preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.reset-settings-btn {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.reset-settings-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ======================
   CONVERSION RESULT
   ====================== */
.conversion-result {
    text-align: center;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.result-header {
    margin-bottom: 2rem;
}

.success-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.result-header h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.result-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.download-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ======================
   BATCH PROCESSING
   ====================== */
.batch-upload {
    margin-bottom: 2rem;
}

.batch-drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.batch-drop-zone:hover,
.batch-drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.batch-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.batch-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.batch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.batch-settings {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.setting-group select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.batch-convert-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* ======================
   BATCH FILES LIST
   ====================== */
.batch-files-list {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 2rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.list-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-all-btn {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-all-btn:hover {
    background: #dc2626;
}

.files-container {
    max-height: 400px;
    overflow-y: auto;
}

.batch-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.batch-file-item:last-child {
    border-bottom: none;
}

.file-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.pending {
    background: rgba(249, 115, 22, 0.1);
    color: var(--warning-color);
}

.status-badge.processing {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.status-badge.completed {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* ======================
   BATCH PROGRESS
   ====================== */
.batch-progress {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-light);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.progress-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-stats {
    color: var(--text-secondary);
}

.overall-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar.small {
    height: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-percentage {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 50px;
    text-align: right;
}

.current-file-info {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.current-file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ======================
   ADVANCED OPTIONS
   ====================== */
.settings-panel {
    display: grid;
    gap: 2rem;
}

.settings-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.settings-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-weight: 500;
    color: var(--text-primary);
}

.setting-item select,
.setting-item input[type="password"],
.setting-item input[type="range"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}

.range-value {
    font-weight: 600;
    color: var(--primary-color);
}

.settings-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* ======================
   HISTORY PANEL
   ====================== */
.history-panel {
    display: grid;
    gap: 2rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.clear-history-btn {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-history-btn:hover {
    background: #dc2626;
}

.history-list {
    display: grid;
    gap: 1rem;
}

.history-item {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.history-file-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.history-file-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-file-name {
    font-weight: 600;
    color: var(--text-primary);
}

.history-file-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.history-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.history-conversion-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.conversion-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.format-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
}

.conversion-arrow-small {
    color: var(--text-muted);
}

.conversion-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ======================
   SIDEBAR
   ====================== */
.tool-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-section {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.2);
}

.sidebar-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section h3 i {
    color: var(--primary-color);
}

/* ======================
   TIPS SECTION
   ====================== */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.tip-icon {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-top: 0.1rem;
}

.tip-text {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ======================
   STATS SECTION
   ====================== */
.stats-grid {
    display: grid;
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
}

.stat-card-icon.files {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.stat-card-icon.formats {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
}

.stat-card-icon.time {
    background: linear-gradient(135deg, var(--accent-color), #d97706);
}

.stat-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-card-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ======================
   PRESETS SECTION
   ====================== */
.presets-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preset-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-item:hover {
    background: var(--primary-color);
    color: white;
}

.preset-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.preset-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.preset-description {
    font-size: 0.8rem;
    opacity: 0.8;
}

.preset-actions {
    display: flex;
    gap: 0.25rem;
}

.preset-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: currentColor;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.preset-action-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* ======================
   NOTIFICATIONS
   ====================== */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    z-index: 1000;
    transform: translateX(400px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--danger-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.notification.info {
    border-left: 4px solid var(--info-color);
}

.notification-icon {
    font-size: 1.25rem;
}

.notification.success .notification-icon {
    color: var(--success-color);
}

.notification.error .notification-icon {
    color: var(--danger-color);
}

.notification.warning .notification-icon {
    color: var(--warning-color);
}

.notification.info .notification-icon {
    color: var(--info-color);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.notification-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.notification-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ======================
   LOADING STATES
   ====================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ======================
   RESPONSIVE DESIGN
   ====================== */
@media (max-width: 1200px) {
    .converter-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .tool-sidebar {
        order: -1;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .header-stats {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .tool-page {
        padding: 1rem;
        gap: 1rem;
    }
    
    .tool-header {
        padding: 1.5rem;
    }
    
    .header-text h1 {
        font-size: 2rem;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .tab-navigation {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .upload-zone {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .batch-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .batch-settings {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .format-comparison {
        flex-direction: column;
        gap: 1rem;
    }
    
    .preview-stats {
        flex-direction: column;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .conversion-details {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .tool-page {
        padding: 0.5rem;
    }
    
    .tool-header {
        padding: 1rem;
    }
    
    .header-text h1 {
        font-size: 1.75rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .upload-zone {
        padding: 1.5rem 0.5rem;
    }
    
    .supported-formats {
        justify-content: flex-start;
    }
    
    .sidebar-section {
        padding: 1rem;
    }
}

/* ======================
   DARK MODE SUPPORT
   ====================== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        
        --bg-primary: #1e293b;
        --bg-secondary: #334155;
        --bg-tertiary: #475569;
        --bg-dark: #0f172a;
        
        --border-color: #475569;
        --border-light: #334155;
    }
    
    body {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
    
    .tool-header,
    .converter-container,
    .sidebar-section {
        background: rgba(30, 41, 59, 0.95);
    }
    
    .template-card {
        background: rgba(30, 41, 59, 0.95);
    }
    
    .template-card:hover {
        background: rgba(51, 65, 85, 1);
    }
}

/* ======================
   ACCESSIBILITY
   ====================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus,
.template-card:focus,
.preset-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --success-color: #008800;
        --danger-color: #cc0000;
        --warning-color: #cc6600;
    }
    
    .template-card,
    .sidebar-section,
    .converter-container {
        border: 2px solid var(--border-color);
    }
}