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

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    margin-top: 20px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
}

h2 {
    color: #34495e;
    margin-bottom: 20px;
}

h3 {
    color: #34495e;
    margin-bottom: 15px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

input[type="file"],
input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="file"]:focus,
input[type="number"]:focus {
    border-color: #3498db;
    outline: none;
}

button {
    background-color: #3498db;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.btn {
    display: inline-block;
    background-color: #27ae60;
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
    text-align: center;
    margin: 5px;
    min-width: 180px;
}

.btn:hover {
    background-color: #219a52;
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background-color: #9b59b6;
}

.btn-secondary:hover {
    background-color: #8e44ad;
}

.btn-secondary:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.hidden {
    display: none;
}

.error {
    background-color: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
}

#loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

.result-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.svg-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    height: 600px;
    background-color: white;
}

.svg-frame {
    width: 100%;
    height: 100%;
}

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

.download-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.legend-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.legend-table-container {
    overflow-x: auto;
}

.legend-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.legend-table th,
.legend-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.legend-table th {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

.legend-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.legend-table tr:hover {
    background-color: #e8f4f8;
}

.color-sample {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: inline-block;
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .svg-container {
        height: 400px;
    }
    
    .result-content {
        gap: 20px;
    }
    
    .download-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .legend-table th,
    .legend-table td {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .color-sample {
        width: 25px;
        height: 25px;
    }
    
    .btn {
        min-width: 150px;
        margin: 3px 0;
    }
}
