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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -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;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1001;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.back-link:hover,
.back-link:focus {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(-2px);
}

.back-icon {
    font-size: 1.2rem;
}

.header-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

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

.converter-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* Converter Card */
.converter-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease-in-out;
}

.converter-title {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
    text-align: center;
}

.converter-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
}

/* File Input Section */
.file-input-section {
    margin-bottom: 2rem;
}

.file-input-label {
    display: block;
    cursor: pointer;
}

.file-drop-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
    position: relative;
}

.file-drop-area:hover,
.file-drop-area:focus {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.file-drop-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
}

.file-info {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Format Section */
.format-section {
    margin-bottom: 2rem;
}

.format-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.format-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.format-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Convert Button */
.convert-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.convert-btn:hover:not(:disabled),
.convert-btn:focus:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.convert-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Progress Section */
.progress-section {
    margin-top: 1.5rem;
}

.progress-container {
    background: #f0f0f0;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

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

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

.progress-text {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* Messages */
.error-container,
.success-container {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

.error-container {
    background: #fee;
    border: 1px solid #fcc;
}

.error-message {
    color: #c33;
    font-weight: 500;
}

.success-container {
    background: #efe;
    border: 1px solid #cfc;
}

.success-message {
    color: #3c3;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Info Panel */
.info-panel {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.info-panel h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1.5rem;
}

.format-list {
    margin-bottom: 2rem;
}

.format-group {
    margin-bottom: 1.5rem;
}

.format-group h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.format-group ul {
    list-style: none;
    padding-left: 0;
}

.format-group li {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.security-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.security-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.security-info p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

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

.footer-links a:hover,
.footer-links a:focus {
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .converter-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .converter-card {
        padding: 1.5rem;
    }

    .converter-title {
        font-size: 1.5rem;
    }

    .file-drop-area {
        padding: 1.5rem;
    }

    .drop-icon {
        font-size: 2rem;
    }

    .info-panel {
        position: static;
        margin-top: 1rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0;
    }

    .converter-container {
        padding: 0 15px;
    }

    .converter-card {
        padding: 1rem;
    }

    .file-drop-area {
        padding: 1rem;
    }

    .drop-text {
        font-size: 1rem;
    }

    .convert-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.8s ease-in-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus styles for accessibility */
button:focus,
a:focus,
select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .convert-btn {
        background: #000;
        color: #fff;
    }

    .file-drop-area {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Keyboard navigation indicator */
.keyboard-navigation *:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}