/* CSS Global Configuration and Variables - Restored to Premium Dark Slate Glassmorphism */
:root {
    --primary: #f9a350;          /* Brand orange CI */
    --primary-hover: #ffb773;    /* Bright orange for hover states */
    --primary-gradient: linear-gradient(135deg, #f9a350 0%, #ff7e15 100%);
    --primary-glow: rgba(249, 163, 80, 0.4);
    --primary-bg-light: rgba(249, 163, 80, 0.08);
    
    --bg-dark: #0d0a1b;          /* Deep dark slate backdrop */
    --bg-darker: #06040d;
    --card-bg: rgba(26, 21, 44, 0.65); /* Glassmorphic base fill */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(249, 163, 80, 0.5);
    
    --text-white: #ffffff;       /* High-contrast crisp white text */
    --text-muted: #a5a1b8;       /* Slate muted text */
    --text-dark: #12101a;        /* Black text for solid primary buttons */
    
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(249, 163, 80, 0.15);
    
    --transition-smooth: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: all 0.2s ease;
}

/* Base resets & typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
}

body {
    font-family: 'Sarabun', 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 1.5rem 0;
}

/* Ambient glow backgrounds for modern visual wow factor */
.bg-glow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
    opacity: 0.45;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background-color: var(--primary);
    top: -150px;
    left: -150px;
}

.bg-glow-2 {
    width: 600px;
    height: 600px;
    background-color: #5b21b6; /* Deep purple */
    bottom: -200px;
    right: -200px;
}

/* Main app container */
.app-container {
    width: 92%;
    max-width: 1200px;
    z-index: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Top Navigation / Toolbar */
.top-toolbar {
    display: flex;
    justify-content: flex-end; /* Align the language switcher pill to the right */
    align-items: center;
    width: 100%;
    padding: 0.5rem 0;
}

/* Language switch toggle (pill design) */
.lang-switch-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    padding: 4px;
    border-radius: 30px;
    display: flex;
    gap: 2px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lang-btn.active {
    background: var(--primary-gradient);
    color: var(--text-dark);
    box-shadow: 0 4px 10px rgba(249, 163, 80, 0.35);
}

.lang-btn:hover:not(.active) {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

/* App Main Title Section (Requirement 4, 8) & Centered Logo */
.app-header-text {
    text-align: center;
    margin: 0.5rem 0 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 2.2rem;
}

.brand-logo {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    transition: var(--transition-smooth);
}

.brand-logo:hover {
    transform: scale(1.03);
}

.app-header-text h1 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.5px;
    background: linear-gradient(120deg, #ffffff 30%, #ffd0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
}

.brand-by {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--primary);
    text-shadow: 0 0 15px rgba(249, 163, 80, 0.3);
}

/* 
 * Layout Grid (Requirement 1): 
 * Centers form container completely in screen space when results card is hidden.
 * Expands to a beautifully balanced side-by-side 2-column view when result-card is shown.
 */
.evaluator-grid {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: center;
    align-items: center;
    max-width: 520px;
    margin: 0 auto;
    gap: 2rem;
    width: 100%;
    transition: var(--transition-smooth);
}

/* Responsive grid expansion using modern `:has()` selector */
.evaluator-grid:has(#result-card:not(.hide)) {
    grid-template-columns: 1fr 1.05fr;
    max-width: 920px;
}

/* Glassmorphic card styling (Dark Theme) */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 2.2rem;
    box-shadow: var(--shadow-premium), var(--shadow-glow);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-premium), 0 0 40px rgba(249, 163, 80, 0.2);
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1rem;
    color: var(--text-white);
}

.brand-icon {
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(249, 163, 80, 0.4));
}

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

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    transition: var(--transition-fast);
}

.form-group:focus-within .form-label {
    color: var(--primary);
}

.required {
    color: var(--primary);
    margin-left: 2px;
}

/* Beautiful custom select menus in dark theme */
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper select {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 20px 14px 48px;
    color: var(--text-white);
    font-size: 0.98rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: var(--transition-smooth);
}

/* Custom dropdown caret */
.select-wrapper::after {
    content: "\f078"; /* FontAwesome angle down */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.82rem;
    color: var(--text-muted);
    position: absolute;
    right: 20px;
    pointer-events: none;
    transition: var(--transition-fast);
}

.select-wrapper:hover select {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.05);
}

.select-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(249, 163, 80, 0.25);
    background: rgba(25, 20, 40, 0.8);
}

.select-wrapper select:focus + .input-icon,
.select-wrapper select:focus ~ ::after {
    color: var(--primary);
}

/* Option tags styling for Dark Theme readability */
.select-wrapper select option {
    background-color: #120e24; /* Dark solid option bg */
    color: var(--text-white); /* White text */
    padding: 12px;
}

.input-icon {
    position: absolute;
    left: 18px;
    color: var(--text-muted);
    font-size: 1.05rem;
    pointer-events: none;
    transition: var(--transition-fast);
}

/* Action button configurations */
.action-buttons {
    display: grid;
    grid-template-columns: 1.45fr 0.8fr;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    border-radius: 12px;
    padding: 15px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-dark);
    box-shadow: 0 6px 20px rgba(249, 163, 80, 0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(249, 163, 80, 0.5);
    filter: brightness(1.05);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(0.95);
}

/* Disabled Evaluate Button styling */
.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
    transform: none;
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-white);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.03);
}

/* Results Card Styles */
.card-result {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Hide animations */
.card-result.hide {
    display: none;
    opacity: 0;
    transform: translateY(30px);
}

/* Simplified Centered Result Layout */
.result-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    width: 100%;
    padding: 0.5rem 0;
}

/* SVG Score Ring styling */
.gauge-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.score-ring {
    transform: rotate(-90deg); /* Start progress circle from 12 o'clock */
}

.score-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.04);
}

.score-ring-progress {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-linecap: round;
    /* Circumference = 2 * PI * 85 = 534.07 */
    stroke-dasharray: 534.07;
    stroke-dashoffset: 534.07;
    transition: stroke-dashoffset 1.8s cubic-bezier(0.1, 1, 0.1, 1);
}

.gauge-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.score-number {
    font-family: 'Inter', sans-serif;
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-white);
    background: linear-gradient(135deg, #ffffff 40%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 10px rgba(249, 163, 80, 0.2));
}

.score-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Centered status badge area */
.result-details {
    width: 100%;
    max-width: 320px;
    display: flex;
    justify-content: center;
}

.badge-status {
    display: block;
    text-align: center;
    width: 100%;
    padding: 12px 28px;
    border-radius: 30px;
    font-family: 'Inter', 'Sarabun', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--transition-smooth);
}

/* Dynamic badges colors for different score ranges (TIER badges) */
.badge-elite {
    background: linear-gradient(135deg, #b91c1c 0%, #f9a350 100%); /* High-level tutor red/orange */
    color: #ffffff;
    box-shadow: 0 0 20px rgba(249, 163, 80, 0.4);
}
.badge-gold {
    background: linear-gradient(135deg, #d4af37 0%, #f9a350 100%);
    color: #120e24;
}
.badge-silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #e5e5e5 100%);
    color: #120e24;
}
.badge-bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #b86214 100%);
    color: #ffffff;
}

/* Footer styling (Minimalist) */
.app-footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1.2rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-glass);
}

/* ==========================================================================
   Responsive Designs: Tablets & Mobiles (Requirement 9)
   ========================================================================== */

/* Tablet View (max-width: 992px) */
@media (max-width: 992px) {
    .app-container {
        gap: 1.5rem;
    }
    
    /* Under tablets, force stacking to single column grid in center */
    .evaluator-grid:has(#result-card:not(.hide)) {
        grid-template-columns: 1fr;
        max-width: 520px;
    }
    
    .app-header-text h1 {
        font-size: 1.9rem;
    }
    
    .brand-logo {
        max-width: 175px;
    }
    
    .glass-card {
        padding: 1.8rem;
    }
}

/* Mobile View (max-width: 600px) */
@media (max-width: 600px) {
    body {
        padding: 0.8rem 0;
    }
    
    .app-container {
        width: 94%;
        gap: 1.2rem;
    }
    
    /* 
     * Top toolbar and switcher on Mobile:
     * Retains row-alignment and compact design exactly like desktop 
     * (as requested in Requirement 2). No full-width stretching!
     */
    .top-toolbar {
        padding-bottom: 0.2rem;
    }
    
    .brand-logo {
        max-width: 165px;
    }

    .app-header-text {
        margin: 0.5rem 0 1.2rem;
    }
    
    .app-header-text h1 {
        font-size: 1.5rem;
    }
    
    .brand-by {
        font-size: 0.95rem;
        letter-spacing: 4px;
    }
    
    .glass-card {
        padding: 1.3rem;
        border-radius: 20px;
    }
    
    .card-title {
        font-size: 1.2rem;
        margin-bottom: 1.4rem;
    }
    
    .select-wrapper select {
        font-size: 0.9rem;
        padding: 12px 14px 12px 42px;
    }
    
    .input-icon {
        left: 15px;
        font-size: 0.95rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr; /* Stack buttons vertically on small devices for thumb safety */
        gap: 0.8rem;
    }
    
    .btn {
        padding: 14px;
        font-size: 0.95rem;
    }
    
    .gauge-container {
        width: 160px;
        height: 160px;
    }
    
    .score-ring {
        width: 160px;
        height: 160px;
    }
    
    .score-number {
        font-size: 2.8rem;
    }
    
    .score-label {
        font-size: 0.75rem;
    }
    
    .badge-status {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}
