/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-light: #667eea;
    --secondary-light: #764ba2;
    --bg-light: #f8f9fa;
    --text-light: #333;
    --text-muted-light: #666;
    --border-light: #ddd;
    --surface-light: rgba(255, 255, 255, 0.95);
    --hover-bg-light: #e9ecef;
    
    --primary-dark: #8b5cf6;
    --secondary-dark: #ec4899;
    --bg-dark: #111827;
    --text-dark: #f9fafb;
    --text-muted-dark: #9ca3af;
    --border-dark: #374151;
    --surface-dark: rgba(31, 41, 55, 0.95);
    --hover-bg-dark: #374151;

    --primary: var(--primary-light);
    --secondary: var(--secondary-light);
    --bg: var(--bg-light);
    --text: var(--text-light);
    --text-muted: var(--text-muted-light);
    --border: var(--border-light);
    --surface: var(--surface-light);
    --hover-bg: var(--hover-bg-light);

    --radius: 16px;
    --shadow: 0 8px 32px rgba(0,0,0,0.1);
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body.dark-mode {
    --primary: var(--primary-dark);
    --secondary: var(--secondary-dark);
    --bg: var(--bg-dark);
    --text: var(--text-dark);
    --text-muted: var(--text-muted-dark);
    --border: var(--border-dark);
    --surface: var(--surface-dark);
    --hover-bg: var(--hover-bg-dark);
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: var(--surface);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.logo-link {
    text-decoration: none;
    justify-self: start;
}

.nav {
    display: flex;
    justify-content: center;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.nav-item.current-page .nav-btn {
    background: var(--hover-bg);
    color: var(--text);
}

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

/* Dropdown Menu Styles */
.nav-item {
    position: relative;
}

.nav-item a {
    text-decoration: none;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    z-index: 1001;
    margin-top: 10px; /* Gap between button and menu */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, margin-top 0.3s ease;
    min-width: 220px;
}

.nav-item:hover .dropdown-menu,
.nav-item.active .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

.dropdown-menu a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background: var(--hover-bg);
    color: var(--secondary);
}

.dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

/* Main Content Styles */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

/* Page Navigation */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

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

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.tool-category h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.tools-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    text-decoration: none !important;
    color: inherit;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    background: var(--surface);
    opacity: 0.9;
}

.tool-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: #fff;
    font-size: 2rem;
}

.tool-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 600;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.tool-card[data-disabled], .tool-card.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.7);
    position: relative;
}

.coming-soon-banner {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff4081;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0.3rem 0.8rem;
    border-bottom-left-radius: 12px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    letter-spacing: 1px;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
    color: var(--text-dark);
}

.back-btn {
    text-decoration: none !important;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dark);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

.page-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* File Upload Area */
.file-upload-area {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 2px dashed var(--primary);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.file-upload-area.dragover {
    border-color: var(--secondary);
    background: var(--surface);
    opacity: 0.9;
    transform: scale(1.02);
}

.upload-content i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.upload-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.upload-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px color-mix(in srgb, var(--primary) 40%, transparent);
}

/* File List */
.file-list {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.file-list h3 {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 1.2rem;
}

.file-list-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.sort-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

.file-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.file-item {
    display: flex;
    flex-grow: 1;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.file-item.dragging {
    opacity: 0.5;
    background: color-mix(in srgb, var(--primary) 20%, transparent);
}

.file-item.drag-over {
    border-top: 2px solid var(--primary);
}

.file-item i {
    font-size: 1.5rem;
    color: var(--primary);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.file-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.process-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.process-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px color-mix(in srgb, var(--primary) 40%, transparent);
}

.process-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Processing Animation */
.processing {
    text-align: center;
    padding: 3rem;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.processing p {
    color: var(--text);
    font-size: 1.1rem;
}

/* Options and Forms */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-weight: 600;
    color: var(--text);
}

.option-group input,
.option-group select {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
}

.option-group input:focus,
.option-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent);
}

.option-group small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Range Input Styling */
.option-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.option-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.option-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Page Thumbnails */
.page-thumbnails {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-thumbnail {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-thumbnail:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.page-thumbnail.selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.page-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.page-thumbnail .page-number {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.page-thumbnail .select-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Conversion Options */
.conversion-options,
.compression-options,
.rotation-options,
.delete-options,
.page-numbers-options,
.watermark-options,
.split-options {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.conversion-options h3,
.compression-options h3,
.rotation-options h3,
.delete-options h3,
.page-numbers-options h3,
.watermark-options h3,
.split-options h3 {
    margin-bottom: 1.5rem;
    color: var(--text);
    font-size: 1.2rem;
}

/* Footer */
.footer {
    background: var(--surface);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .tools-row {
        grid-template-columns: 1fr;
    }
    
    .tool-card {
        padding: 1.5rem;
    }
    
    .file-upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-content i {
        font-size: 3rem;
    }
    
    .upload-content h3 {
        font-size: 1.2rem;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .file-actions {
        flex-direction: column;
    }
    
    .process-btn {
        width: 100%;
        justify-content: center;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .tool-card {
        padding: 1rem;
    }
    
    .tool-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

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

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 1rem;
    z-index: 9999;
    opacity: 0.95;
    display: none;
    transition: opacity 0.3s;
}

.toast.info { background: var(--primary); }
.toast.success { background: #4caf50; }
.toast.error { background: #e53935; }

:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
[aria-live], .toast {
    aria-live: polite;
}
@media (prefers-contrast: more) {
    body, .tool-card, .header, .footer {
        background: #fff !important;
        color: #000 !important;
    }
}

/* Content Sections */
.content-section {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius);
    margin: 3rem 0;
    backdrop-filter: blur(5px);
}

.content-section h2 {
    text-align: center;
    font-size: 1.8rem;
    color: var(--text);
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    text-align: center;
}

.feature-item i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.feature-item h3 {
    font-size: 1.2rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.feature-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.faq-item h4 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.faq-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Custom Form Elements */
.radio-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.radio-group input[type="radio"] {
    display: none;
}
.radio-group label {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
}
.radio-group input[type="radio"]:checked + label {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    border: none;
    overflow: hidden;
}
progress::-webkit-progress-bar {
    background-color: #eee;
}
progress::-webkit-progress-value {
    background-color: var(--primary);
    transition: width 0.3s ease;
}
progress::-moz-progress-bar {
    background-color: var(--primary);
}

/* How-To Steps */
.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    text-align: center;
}

.step-item .step-number {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.step-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.step-item p {
    color: var(--text-muted);
}

/* Related Tools */
.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.tool-card-small {
    text-decoration: none;
    color: inherit;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.tool-card-small:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--primary);
    background: var(--hover-bg);
}

.tool-card-small .tool-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.tool-card-small h4 {
    font-size: 1.1rem;
}

.tool-card-small p {
    font-size: 0.9rem;
}

.file-item .file-thumbnail {
    width: 50px;
    height: 70px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-item .file-thumbnail canvas {
    max-width: 100%;
    max-height: 100%;
}

.file-item p {
    color: #666;
}

.file-list-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.file-order-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 30px;
    text-align: right;
    flex-shrink: 0;
} 