/* =====================================================
   Universal Conversion Tool - Main Stylesheet
   Modern, responsive design with smooth animations
   ===================================================== */

/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.3s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Horizontal Menu Bar */
.horizontal-menu {
    background: white;
    box-shadow: var(--shadow-md);
    margin: -2rem -1rem 2rem -1rem;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.menu-item {
    position: relative;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    border: none;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.menu-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.menu-btn svg {
    flex-shrink: 0;
}

/* Dropdown */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: var(--transition);
}

.dropdown-content a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Mobile menu */
@media (max-width: 768px) {
    .horizontal-menu {
        margin: -1rem -1rem 1rem -1rem;
    }
    
    .menu-container {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 0.5rem;
    }
    
    .menu-container::-webkit-scrollbar {
        display: none;
    }
    
    .menu-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .dropdown-content {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        min-width: 90%;
        max-width: 300px;
    }
}

/* Main Content */
.main-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    margin-bottom: 3rem;
    min-height: 400px;
}

/* Upload Section */
.upload-section {
    text-align: center;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
}

.btn-convert {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    margin-top: 2rem;
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-convert:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-convert:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-download {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--error-color);
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-text {
    display: inline-flex;
}

/* File Info Section */
.file-info-section {
    animation: fadeIn 0.3s ease;
}

.file-info-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.file-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-details h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-details p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Format Selection */
.format-selection label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.format-option {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    transition: var(--transition);
}

.format-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.format-option.selected {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

/* Progress Section */
.progress-section {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.progress-card h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 999px;
    transition: width 0.3s ease;
    animation: shimmer 2s infinite;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Download Section */
.download-section {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.success-card {
    max-width: 500px;
    margin: 0 auto;
}

.success-icon {
    color: var(--success-color);
    margin-bottom: 1rem;
}

.success-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.success-card > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.download-info {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    text-align: left;
}

.download-info p {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.download-info strong {
    color: var(--text-primary);
}

.download-info span {
    color: var(--text-secondary);
}

/* Error Section */
.error-section {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.error-card {
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-card h2 {
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Features Section */
.features {
    background: white;
    padding: 3rem 2rem;
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.features h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    background: var(--bg-secondary);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Formats Section */
.formats {
    background: white;
    padding: 3rem 2rem;
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.formats h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
}

.format-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.format-category {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.format-category h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.format-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
}

.tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
}

.footer p {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

/* Spinner */
.spinner {
    animation: rotate 1s linear infinite;
}

.spinner circle {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    animation: dash 1.5s ease-in-out infinite;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Ensure upload section is always visible by default */
#uploadSection {
    display: block;
}

#uploadSection.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

@keyframes shimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .features,
    .formats {
        padding: 2rem 1rem;
    }
    
    .features h2,
    .formats h2 {
        font-size: 1.5rem;
    }
    
    .format-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .toast {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .file-info-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Multi-File Converter Styles */
.multi-file-converter {
    padding: 2rem 0;
}

.files-list {
    margin: 2rem 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: white;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}

.file-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    color: var(--text-secondary);
    margin: 0 1rem;
}

.conversion-options {
    margin: 2rem 0;
}

.results {
    margin-top: 2rem;
}

.conversion-result {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-status {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Print Styles */
@media print {
    .upload-section,
    .features,
    .formats,
    .footer {
        display: none;
    }
}

/* =====================================================
   PDF EDITOR STYLES
   ===================================================== */

.pdf-editor-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    margin-bottom: 2rem;
}

.pdf-upload-section {
    text-align: center;
    padding: 3rem 2rem;
}

.pdf-editor-main {
    display: none;
}

.pdf-editor-main.active {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 1.5rem;
    min-height: 600px;
}

/* PDF Editor Toolbar */
.pdf-toolbar {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    height: fit-content;
}

.pdf-toolbar h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tool-group {
    margin-bottom: 1.5rem;
}

.tool-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.tool-btn {
    width: 100%;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.tool-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tool-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.color-picker-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-picker {
    flex: 1;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.font-size-input,
.font-family-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
}

/* PDF Canvas Area */
.pdf-canvas-area {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: auto;
    max-height: 800px;
}

.canvas-wrapper {
    position: relative;
    background: white;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1rem;
}

#pdfCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

#editCanvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
}

.canvas-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.canvas-controls button {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.canvas-controls button:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

/* PDF Pages Panel */
.pdf-pages-panel {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    height: fit-content;
    max-height: 800px;
    overflow-y: auto;
}

.pdf-pages-panel h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-thumbnail {
    width: 100%;
    padding: 0.5rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.page-thumbnail:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.page-thumbnail.active {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.page-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.page-thumbnail p {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* OCR Progress */
.ocr-progress {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
}

.ocr-progress h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.ocr-status {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-top: 1rem;
}

/* Action Buttons */
.pdf-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Responsive PDF Editor */
@media (max-width: 1200px) {
    .pdf-editor-main.active {
        grid-template-columns: 200px 1fr;
    }
    
    .pdf-pages-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .pdf-editor-main.active {
        grid-template-columns: 1fr;
    }
    
    .pdf-toolbar {
        margin-bottom: 1rem;
    }
    
    .pdf-canvas-area {
        padding: 1rem;
    }
}

