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

body {
    font-family: 'Stylish', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

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

/* Main Content */
main {
    padding: 40px;
}

/* Upload Section */
.upload-section {
    max-width: 600px;
    margin: 0 auto;
}

.file-upload-wrapper {
    margin-bottom: 30px;
}

.file-label {
    display: block;
    padding: 60px 20px;
    border: 3px dashed #667eea;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.file-label:hover,
.file-label.drag-over {
    background: #e9ecef;
    border-color: #764ba2;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

#fileName {
    display: block;
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 10px;
}

#fileName.has-file {
    color: #667eea;
    font-weight: 600;
}

.file-types {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
}

#fileInput {
    display: none;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

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

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

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

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

.option-group small {
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.85rem;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.process-btn,
.download-btn,
.new-conversion-btn,
.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-family: 'Stylish', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.process-btn:hover:not(:disabled),
.download-btn:hover,
.new-conversion-btn:hover,
.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

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

.download-btn {
    padding: 10px 20px;
    font-size: 0.95rem;
}

/* Progress Section */
.progress-section {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.progress-section h3 {
    margin-bottom: 20px;
    color: #495057;
}

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

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

#progressText {
    color: #6c757d;
}

/* Results Section */
.results-section h3 {
    text-align: center;
    margin-bottom: 30px;
    color: #495057;
}

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

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

.result-item h4 {
    margin-bottom: 15px;
    color: #495057;
}

.image-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-container img {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border-radius: 8px;
}

.new-conversion-btn {
    max-width: 300px;
    margin: 0 auto;
    display: block;
}

/* Error Section */
.error-section {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.error-section h3 {
    color: #dc3545;
    margin-bottom: 20px;
}

#errorMessage {
    color: #495057;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    main {
        padding: 20px;
    }
}

/* SVG Container Specific Styles */
#svgContainer svg {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
}

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

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

.results-section:not(.hidden) .result-item {
    animation: fadeIn 0.5s ease forwards;
}

.results-section:not(.hidden) .result-item:nth-child(1) {
    animation-delay: 0.1s;
}

.results-section:not(.hidden) .result-item:nth-child(2) {
    animation-delay: 0.2s;
}

.results-section:not(.hidden) .result-item:nth-child(3) {
    animation-delay: 0.3s;
}

.results-section:not(.hidden) .result-item:nth-child(4) {
    animation-delay: 0.4s;
}