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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-display: swap;
}

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

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px 0;
    text-align: center;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: #ffd700;
    animation: pulse 2s infinite;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tagline {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    padding: 40px 0;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 60px;
    color: white;
}

.hero-content h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

/* Converter Section */
.converter-section {
    margin-bottom: 80px;
}

.converter-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #dee2e6;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    margin: 40px;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: scale(1.02);
}

.upload-content i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #495057;
}

.upload-content p {
    color: #6c757d;
    font-size: 1rem;
    margin-bottom: 20px;
}

.upload-formats {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.format-badge {
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* File Preview */
.file-preview {
    margin: 40px;
    border: 1px solid #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    background: white;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.preview-header h4 {
    color: #495057;
    font-weight: 600;
}

.clear-files {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 0.9rem;
}

.clear-files:hover {
    background: #c82333;
}

.files-list {
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.file-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 15px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

.file-details {
    font-size: 0.9rem;
    color: #6c757d;
}

.file-remove {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Conversion Options */
.conversion-options {
    padding: 40px;
    border-top: 1px solid #e9ecef;
}

.conversion-options h3 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #495057;
    text-align: center;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

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

.option-group label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 10px;
}

.option-group select,
.option-group input[type="range"] {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.option-group select:focus,
.option-group input[type="range"]:focus {
    outline: none;
    border-color: #667eea;
}

.quality-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 5px;
}

.option-group input[type="checkbox"] {
    margin-right: 10px;
}

/* Convert Button */
.convert-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
    display: block;
    margin: 0 auto;
    width: 200px;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

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

.convert-btn i {
    margin-right: 10px;
}

/* Progress Section */
.progress-section {
    padding: 40px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.progress-header h4 {
    color: #495057;
    font-weight: 600;
}

.progress-percentage {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-details {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Results Section */
.results-section {
    padding: 40px;
    text-align: center;
    border-top: 1px solid #e9ecef;
    background: #f8fff9;
}

.results-header {
    margin-bottom: 30px;
}

.results-header h4 {
    color: #28a745;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.results-summary {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.download-btn i {
    font-size: 1rem;
}

/* Features Section */
.features-section {
    margin-bottom: 80px;
    text-align: center;
    color: white;
}

.features-section h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 50px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card i {
    font-size: 3rem;
    color: #ffd700;
    margin-bottom: 20px;
}

.feature-card h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.feature-card p {
    opacity: 0.9;
    line-height: 1.6;
}

/* How It Works */
.how-it-works {
    margin-bottom: 80px;
    text-align: center;
    color: white;
}

/* Related Tools */
.related-tools {
    margin-bottom: 80px;
    text-align: center;
    color: white;
}

.related-tools h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 50px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.tool-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
}

.tool-card i {
    font-size: 3rem;
    color: #ffd700;
    margin-bottom: 20px;
}

.tool-card h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.tool-card p {
    opacity: 0.9;
    margin-bottom: 20px;
    line-height: 1.6;
}

.tool-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-links a {
    color: #ffd700;
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.tool-links a:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: #ffd700;
    transform: translateX(5px);
}

.how-it-works h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 50px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-top: 50px;
}

.step {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
}

.step-number {
    width: 60px;
    height: 60px;
    background: #ffd700;
    color: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 20px;
}

.step h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.step p {
    opacity: 0.9;
    line-height: 1.6;
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px 0 20px;
    color: white;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.footer-brand h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.footer-brand p {
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.8;
}

.footer-educational {
    margin-top: 15px;
    font-size: 0.9rem;
}

.footer-educational a {
    color: #ffd700;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-educational a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Layout Shift Prevention */
.main-content {
    contain: layout;
    min-height: 100vh;
}

.hero {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero h2 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero p {
    line-height: 1.4;
}

.converter-card {
    min-height: 400px;
    contain: layout;
}

.upload-area {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.features-section {
    min-height: 300px;
    contain: layout;
}

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

.feature-card {
    min-height: 150px;
    contain: layout;
}

/* Font loading optimization */
@font-face {
    font-family: 'Inter';
    font-display: swap;
    font-weight: 300 800;
}

/* Reserve space for icons */
.fas, .fa {
    width: 1em;
    height: 1em;
    display: inline-block;
}

/* URL Upload Section */
.url-upload-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.url-upload-header {
    text-align: center;
    margin-bottom: 1rem;
}

.url-upload-header h4 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
    color: #4CAF50;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.url-upload-header p {
    opacity: 0.8;
    margin: 0;
    font-size: 0.9rem;
}

.url-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.url-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.url-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

.url-input:focus {
    outline: none;
    border-color: #4CAF50;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.url-input:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.fetch-url-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.fetch-url-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.fetch-url-btn:disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.url-examples {
    margin-top: 1rem;
    text-align: center;
}

.url-examples small {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
}

/* Loading state for URL fetch */
.url-upload-area.loading .fetch-url-btn {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

.url-upload-area.loading .fetch-url-btn i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error state */
.url-upload-area.error {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.url-upload-area.error .url-input {
    border-color: #f44336;
}

/* Success state */
.url-upload-area.success {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.slide-in {
    animation: slideIn 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .hero-content h2 {
        font-size: 2.5rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
    
    .upload-area {
        margin: 20px;
        padding: 40px 15px;
    }
    
    .conversion-options {
        padding: 20px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .steps {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .upload-area {
        margin: 15px;
        padding: 30px 10px;
    }
    
    .convert-btn {
        width: 100%;
        padding: 15px 30px;
    }
    
    .results-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .download-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.processing {
    animation: pulse 1.5s infinite;
}

/* Success States */
.success {
    color: #28a745;
}

.error {
    color: #dc3545;
}

.warning {
    color: #ffc107;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.content-section {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 2.5rem;
    margin: 2.5rem 0;
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.content-section h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.content-section p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
}

.content-section p:last-child {
    margin-bottom: 0;
}