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

:root {
    --primary-color: #24586e;
    --primary-dark: #1a3d52;
    --primary-light: #d4e6f1;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #47637b 0%, #29363e 100%);
    color: var(--text-dark);
    min-height: 100vh;
}

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

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

header .logo {
    max-width: 500px;
    height: auto;
    margin-bottom: 0px;
}

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

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Main */
main {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Form Sections */
.form-section {
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-dark);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.radio-group input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Input Divs */
.input-div {
    margin-top: 15px;
}

.input-div label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input[type="file"] {
    display: block;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    width: 100%;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 10px;
}

input[type="file"]::file-selector-button:hover {
    background-color: var(--primary-dark);
}

small {
    display: block;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* Feature Groups */
.feature-group {
    margin-bottom: 30px;
}

.feature-group > label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.dropdown-container {
    position: relative;
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
    max-height: 200px;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

select[multiple] {
    min-height: 120px;
    padding: 8px;
}

select[multiple] option {
    padding: 8px;
    margin-bottom: 4px;
}

select[multiple] option:checked {
    background: linear-gradient(
        var(--primary-color),
        var(--primary-color)
    );
    background-color: var(--primary-color) !important;
    color: white;
}

/* Checkbox Group Styling */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 12px;
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.checkbox-group label:hover {
    background-color: var(--primary-light);
}

.checkbox-group input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.checkbox-group input[type="checkbox"]:checked + {
    color: var(--primary-dark);
}

/* Buttons */
.btn-submit {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color));
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-submit span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-new-prediction {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.btn-new-prediction:hover {
    background-color: var(--primary-dark);
}

.btn-close-error {
    background-color: var(--error-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
}

.btn-close-error:hover {
    background-color: #dc2626;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 20px;
}

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

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

.loading-spinner p {
    color: var(--text-light);
    font-weight: 500;
}

/* Results Section */
.results-section {
    padding: 30px;
    background-color: var(--bg-light);
}

.results-section h2 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--text-dark);
}

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

/* Result Cards */
.result-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.result-card h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.result-card p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: var(--text-light);
}

.result-card p:last-child {
    margin-bottom: 0;
}

.result-card strong {
    color: var(--text-dark);
}

#conjugationSystems {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.conj-badge {
    display: inline-block;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Primary Prediction Card */
.primary-prediction {
    border-left-color: var(--success-color);
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #f0fdf4 0%, #f0fdf4 100%);
}

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

.top-prediction {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 10px;
}

.confidence {
    font-size: 1.3rem;
    color: var(--text-light);
}

#topProbability {
    color: var(--success-color);
    font-weight: 700;
}

/* Predictions Chart */
.predictions-chart {
    grid-column: 1 / -1;
}

.prediction-item {
    margin-bottom: 15px;
}

.prediction-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 500;
}

.prediction-bar {
    background-color: var(--border-color);
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
}

.prediction-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    transition: width 0.5s ease;
}

/* Info Card */
.info-card {
    background-color: #e8f4f8;
    border-left-color: #24586e;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.5;
}

.info-card li:last-child {
    border-bottom: none;
}

/* Error Section */
.error-section {
    margin: 30px;
    padding: 20px;
    background-color: #fef2f2;
    border: 2px solid var(--error-color);
    border-radius: 8px;
    color: #991b1b;
}

.error-section h3 {
    margin-bottom: 10px;
    color: var(--error-color);
}

.error-section p {
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    .form-section,
    .results-section {
        padding: 20px;
    }

    .form-section h2,
    .results-section h2 {
        font-size: 1.3rem;
    }

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

    .primary-prediction {
        grid-column: 1;
    }

    .predictions-chart {
        grid-column: 1;
    }

    .radio-group {
        flex-direction: column;
        gap: 12px;
    }

    textarea {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .form-section,
    .results-section {
        padding: 15px;
    }

    .btn-submit {
        font-size: 1rem;
        padding: 12px 20px;
    }

    textarea {
        min-height: 150px;
    }

    .top-prediction {
        font-size: 1.5rem;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section,
.error-section {
    animation: slideIn 0.3s ease;
}

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