:root {
    --primary: #1e3a5f;
    --primary-light: #2d4a6f;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --background: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, #0f1f35 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

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

.logo svg {
    width: 40px;
    height: 40px;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.lang-select option {
    color: var(--text);
    background: white;
}

/* Main Card */
.main-card {
    background: var(--card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.title {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Rating Type Buttons */
.rating-types {
    display: flex;
    gap: 0.5rem;
}

.rating-type-btn {
    flex: 1;
    padding: 0.625rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-type-btn:hover {
    border-color: var(--primary-light);
}

.rating-type-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}


/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 0.5rem;
}

.submit-btn:hover {
    background: var(--accent-hover);
}

.submit-btn:active {
    transform: scale(0.98);
}

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

/* Result Display */
.result-section {
    display: none;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.result-section.visible {
    display: block;
}

.result-text {
    text-align: center;
    margin-bottom: 1rem;
}

.result-prefix {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.result-percentage {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.result-suffix {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Level Bar */
.level-bar {
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.level-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 6px;
    transition: width 1s ease-out;
    width: 0;
}

.sample-size {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Info Section */
.info-section {
    margin-top: auto;
    padding-top: 1.5rem;
}

.info-item {
    border-top: 1px solid var(--border);
    padding: 1rem 0;
}

.info-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.info-content {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* Loading State */
.loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
}

.loading.visible {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error State */
.error-message {
    display: none;
    background: #fef2f2;
    color: var(--error);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    text-align: center;
    margin-top: 1rem;
}

.error-message.visible {
    display: block;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --card: #1e293b;
        --text: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #334155;
    }
    
    .form-input,
    .form-select,
    .rating-type-btn {
        background: #0f172a;
        color: var(--text);
    }
    
    .rating-type-btn.active {
        background: var(--primary);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0.75rem;
    }
    
    .main-card {
        padding: 1.25rem;
    }
    
    .title {
        font-size: 1.25rem;
    }
    
    .result-percentage {
        font-size: 2.5rem;
    }
}
