/* ========================================
   PDF Converter - Modern Dark Theme
   ======================================== */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(24, 24, 35, 0.8);
    --bg-card-hover: rgba(32, 32, 48, 0.9);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --gradient-pink: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-orange: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    /* Spacing */
    --container-width: 1200px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

.hidden {
    display: none !important;
}

/* ======== Header ======== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-purple);
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

/* ======== Hero ======== */
.hero {
    padding: 140px 0 60px;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* ======== Tools Section ======== */
.tools-section {
    padding: 40px 0 80px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

.tool-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
}

.tool-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.tool-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.tool-icon.pdf-to-image { background: var(--gradient-purple); }
.tool-icon.image-to-pdf { background: var(--gradient-blue); }
.tool-icon.extract-text { background: var(--gradient-pink); }
.tool-icon.merge { background: var(--gradient-green); }
.tool-icon.split { background: var(--gradient-orange); }

.tool-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.tool-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ======== Converter Panel ======== */
.converter-panel {
    padding: 100px 0 60px;
    min-height: 100vh;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 32px;
    transition: color var(--transition-fast);
}

.back-btn:hover {
    color: var(--text-primary);
}

.panel-header {
    text-align: center;
    margin-bottom: 48px;
}

.panel-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.panel-desc {
    color: var(--text-secondary);
}

/* ======== Upload Zone ======== */
.upload-zone {
    background: var(--bg-card);
    border: 2px dashed var(--glass-border);
    border-radius: var(--border-radius);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.05);
}

.upload-zone.dragover {
    transform: scale(1.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-purple);
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-subtext {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ======== File List ======== */
.file-list {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-top: 24px;
}

.file-list h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-list ul {
    list-style: none;
}

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
}

.file-list li:last-child {
    margin-bottom: 0;
}

.file-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
    margin-left: 16px;
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: 12px;
    transition: color var(--transition-fast);
}

.file-remove:hover {
    color: #ef4444;
}

/* ======== Options Panel ======== */
.options-panel {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-top: 24px;
}

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
}

.option-row:last-child {
    border-bottom: none;
}

.option-label {
    font-weight: 500;
}

.option-select,
.option-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 10px 16px;
    font-size: 0.875rem;
    min-width: 180px;
    transition: all var(--transition-fast);
}

.option-select:focus,
.option-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.1);
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-purple);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* ======== Convert Button ======== */
.convert-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 32px;
    margin-top: 32px;
    background: var(--gradient-purple);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}

.convert-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======== Progress ======== */
.progress-container {
    margin-top: 32px;
    text-align: center;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-purple);
    border-radius: 8px;
    transition: width 0.3s ease;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ======== Result Section ======== */
.result-section {
    text-align: center;
    padding: 48px;
    margin-top: 32px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-green);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.result-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.result-files {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.result-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.result-file:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-purple);
}

.download-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--gradient-purple);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.download-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}

/* ======== Toast ======== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    padding: 16px 24px;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(20px);
    z-index: 1000;
    transition: transform var(--transition-normal);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.1);
}

/* ======== Responsive ======== */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .tool-card {
        padding: 24px 16px;
    }
    
    .tool-icon {
        width: 48px;
        height: 48px;
    }
    
    .tool-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .option-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .option-select,
    .option-input {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .nav {
        gap: 16px;
    }
}
