:root {
    --primary: #0078d4;
    --primary-dark: #214363;
    --secondary: #5c80f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0078d4 0%, #012846 100%);
    min-height: 100vh;
    padding: 2rem;
    color: white;
}

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

.header {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 0.5px 0.5px rgb(0, 0, 0));
}

.header-text {
    flex: 1;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.main-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.drop-zone {
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 2rem;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.drop-zone-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.setting-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.setting-item label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

.setting-item input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(28px);
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(2, 6, 250, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(113, 115, 230, 0.6);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.file-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.file-preview {
    width: 60px;
    height: 80px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: transform 0.2s;
}

.file-preview:hover {
    transform: scale(1.05);
}

.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.preview-modal.active {
    display: flex;
}

.preview-content {
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 8px;
    padding: 3rem 1rem 1rem 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
}

.preview-canvas {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 4px;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.preview-btn {
    background: #0078d4;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.preview-btn:hover:not(:disabled) {
    background: #005a9e;
}

.preview-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.preview-page-info {
    font-weight: 600;
    color: #333;
    min-width: 100px;
    text-align: center;
}

.download-progress-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.download-progress-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, var(--success), #059669);
    transition: width 0.3s ease;
    z-index: 0;
}

.download-progress-btn span {
    position: relative;
    z-index: 1;
}

.progress-container {
    margin-top: 2rem;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), white);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-weight: 600;
}

.results {
    display: none;
    margin-top: 2rem;
}

.results.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.value-display {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    margin-left: 0.5rem;
}

#fileInput {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .header {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .main-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .drop-zone-icon {
        font-size: 3rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .file-item {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }

    .file-info {
        flex-direction: column;
        text-align: center;
    }

    .file-actions {
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
    }

    .preview-content {
        padding: 2rem 0.5rem 0.5rem 0.5rem;
        width: 95%;
    }

    .preview-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}
