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

:root {
    --primary-color: #4F5B93;
    --primary-hover: #3d4773;
    --secondary-color: #6c757d;
    --background: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --code-bg: #f5f5f5;
    --error-bg: #fff3cd;
    --error-text: #856404;
    --error-border: #ffeaa7;
    --success-bg: #d4edda;
    --success-text: #155724;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Courier New", Courier, monospace;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--background);
    line-height: 1.6;
}

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

/* Header */
header {
    text-align: center;
    padding: 40px 0;
    margin-bottom: 40px;
}

.logo {
    height: 60px;
    width: auto;
    vertical-align: middle;
    margin-right: 15px;
}

header h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
    display: inline;
    vertical-align: middle;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
}

/* Main Workspace */
.workspace {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

/* Input Section */
.input-section,
.options-section {
    display: flex;
    flex-direction: column;
}

.input-section h2,
.options-section h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

#input {
    width: 100%;
    height: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    resize: vertical;
    background-color: var(--code-bg);
    transition: border-color 0.3s;
}

#input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Options Section */
.options-container {
    background-color: var(--code-bg);
    padding: 20px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    height: 100%;
}

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

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.option-group input[type="number"],
.option-group select {
    width: 100%;
    padding: 8px 12px;
    padding-right: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    background-color: var(--background);
    transition: border-color 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.option-group select {
    padding-right: 32px;
}

.option-group input[type="number"]:focus,
.option-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.option-group small {
    display: block;
    margin-top: 5px;
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-family);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

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

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading p {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* Result Section */
.result-section {
    margin-bottom: 30px;
}

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

.result-header h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.result-output {
    background-color: var(--code-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Error Section */
.error-section {
    margin-bottom: 30px;
}

.error-section h2 {
    font-size: 1.3rem;
    color: var(--error-text);
    margin-bottom: 10px;
}

.error-output {
    background-color: var(--error-bg);
    border: 2px solid var(--error-border);
    border-radius: 4px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--error-text);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    color: var(--secondary-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

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

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .result-header .btn-small {
        width: 100%;
    }
}
