/* ==========================================================================
   TB Risk Assessment — Colorful Modern Gradient UI
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Vibrant & Gradients */
    --primary: #0070F3;         
    --primary-gradient: linear-gradient(135deg, #3a7bd5 0%, #00d2ff 100%);
    --primary-gradient-hover: linear-gradient(135deg, #2b5fac 0%, #00bced 100%);
    --primary-light: #EBF4FF;
    
    --success: #10B981;
    --success-gradient: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    
    --danger: #EF4444;
    --danger-gradient: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
    
    --warning: #F59E0B;
    --warning-gradient: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);

    --bg-page-gradient: linear-gradient(135deg, #f0f4fd 0%, #e4eeff 50%, #f4efff 100%); 
    --card-bg: rgba(255, 255, 255, 0.95);
    
    --text-main: #111827;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    
    /* Layout */
    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    /* Colorful Shadows */
    --shadow-sm: 0 4px 6px -1px rgba(0, 112, 243, 0.08);
    --shadow-md: 0 12px 25px -5px rgba(0, 112, 243, 0.15);
    --shadow-glow: 0 0 20px rgba(0, 210, 255, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background: var(--bg-page-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: "Kanit", sans-serif;
    font-weight: 300;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 64px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Kanit", sans-serif;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
}

p { color: var(--text-muted); }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover { color: #00d2ff; text-decoration: underline; }

/* --------------------------------------------------------------------
   Hero / Header Area
   -------------------------------------------------------------------- */
.app-header {
    background: var(--primary-gradient);
    color: white;
    padding: 70px 20px 80px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 112, 243, 0.2);
    border-radius: 0 0 40px 40px;
}
.app-header h1 {
    color: white;
    font-size: 2.2rem;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.app-header p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------
   Cards & Containers
   -------------------------------------------------------------------- */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}
.app-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-top: -40px; 
    position: relative;
    z-index: 10;
}

/* --------------------------------------------------------------------
   Form Elements (starter.php)
   -------------------------------------------------------------------- */
.form-section {
    padding: 32px 0;
    border-bottom: 1px dashed rgba(0, 112, 243, 0.15);
}
.form-section:last-child {
    border-bottom: none;
}
.question-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}
.question-title i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-right: 12px;
    font-size: 1.4rem;
    width: 24px;
    text-align: center;
}

/* Text / Number Inputs */
.modern-input {
    width: 100%;
    max-width: 300px;
    padding: 14px 18px;
    font-family: "Kanit", sans-serif;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #f8fafc;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.modern-input:focus {
    outline: none;
    border-color: #00d2ff;
    background-color: #fff;
    box-shadow: var(--shadow-glow);
}

/* Custom Checkbox & Radio Wrappers */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.custom-option {
    display: flex;
    align-items: flex-start;
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    position: relative;
    overflow: hidden;
}
.custom-option:hover {
    border-color: #00d2ff;
    background: var(--primary-light);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 210, 255, 0.1);
}
.custom-option input[type="radio"],
.custom-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid #cbd5e1;
    margin-right: 16px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: white;
    margin-top: 1px;
}
.custom-option input[type="radio"] { border-radius: 50%; }
.custom-option input[type="checkbox"] { border-radius: 8px; }

/* Checked State */
.custom-option input[type="radio"]:checked,
.custom-option input[type="checkbox"]:checked {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 210, 255, 0.4);
}
.custom-option input[type="checkbox"]:checked::after {
    content: '\f00c';
    font-family: 'FontAwesome';
    color: white;
    font-size: 13px;
}
.custom-option input[type="radio"]:checked::after {
    content: '';
    width: 10px;
    height: 10px;
    background-color: white;
    border-radius: 50%;
}
.custom-option label {
    cursor: pointer;
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--text-main);
    width: 100%;
    margin-bottom: 0;
    line-height: 1.5;
}

/* Dependent / Sub-questions */
.sub-question-box {
    margin-top: 16px;
    padding: 24px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    border-left: 5px solid #00d2ff;
}

/* --------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------- */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 99px;
    padding: 16px 32px;
    font-family: "Kanit", sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    width: 100%;
    box-shadow: 0 8px 20px rgba(0, 112, 243, 0.25);
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.btn-modern::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}
.btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 210, 255, 0.35);
    color: white;
}
.btn-modern:hover::after { opacity: 1; }

.btn-modern.btn-success {
    background: var(--success-gradient);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}
.btn-modern.btn-success:hover {
    box-shadow: 0 12px 25px rgba(16, 185, 129, 0.35);
}
.btn-modern.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}
.btn-modern.btn-outline:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(0, 112, 243, 0.25);
}

/* --------------------------------------------------------------------
   Results Page (resultstestdb.php)
   -------------------------------------------------------------------- */
.result-card {
    text-align: center;
    padding: 50px 30px;
}
.result-icon {
    font-size: 6rem;
    margin-bottom: 24px;
    background: -webkit-linear-gradient(#333, #eee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.1));
}
.result-icon.safe { 
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.result-icon.warning { 
    background: var(--warning-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.result-icon.danger { 
    background: var(--danger-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}
.result-title.safe { color: #059669; }
.result-title.warning { color: #D97706; }
.result-title.danger { color: #DC2626; }

.result-subtitle {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 40px;
}

.advice-section {
    text-align: left;
    background: #ffffff;
    padding: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.advice-section h4 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 2px dashed rgba(0, 210, 255, 0.3);
    padding-bottom: 12px;
    margin-bottom: 20px;
    font-size: 1.4rem;
}
.advice-section ul {
    list-style: none;
    padding-left: 0;
}
.advice-section ul li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 16px;
    color: var(--text-main);
    font-size: 1.05rem;
}
.advice-section ul li::before {
    content: '\f058';
    font-family: 'FontAwesome';
    color: #00d2ff;
    position: absolute;
    left: 0;
    top: 4px;
    font-size: 1.1rem;
}

.note-section {
    text-align: left;
    font-size: 0.95rem;
    color: var(--text-muted);
    background: #FFFBEB;
    padding: 24px;
    border-radius: var(--radius-md);
    border-left: 4px solid #F59E0B;
}
.note-section h5 {
    color: #D97706;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

/* --------------------------------------------------------------------
   Landing Page specific classes (index.php)
   -------------------------------------------------------------------- */
.feature-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 1);
    padding: 40px;
    border-radius: var(--radius-lg);
    text-align: left;
    height: 100%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.feature-card:hover {
    box-shadow: 0 15px 40px rgba(0, 112, 243, 0.12);
    transform: translateY(-8px);
    border-color: #00d2ff;
}
.feature-card h3 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
    margin-bottom: 20px;
}
.feature-card ul {
    padding-left: 20px;
    color: var(--text-muted);
}
.feature-card ul li {
    margin-bottom: 12px;
}
.footer {
    background: linear-gradient(135deg, #111827 0%, #1F2937 100%);
    color: rgba(255,255,255,0.7);
    padding: 50px 0;
    margin-top: 80px;
    text-align: center;
    border-top: 4px solid #00d2ff;
}
.footer p { color: rgba(255,255,255,0.7); }

/* Responsive */
@media (max-width: 768px) {
    .app-card {
        padding: 30px 20px;
    }
    .btn-modern {
        width: 100%;
    }
    .app-header {
        border-radius: 0 0 20px 20px;
    }
}

/* --------------------------------------------------------------------
   Sex Grid Custom Colors
   -------------------------------------------------------------------- */
.sex-grid {
    flex-direction: row !important;
}
.sex-grid .custom-option {
    flex: 1;
    text-align: center;
    justify-content: center;
}

/* Male Option (Blue) */
.option-male:hover {
    border-color: #3b82f6 !important;
    background: #eff6ff !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15) !important;
}
.option-male input[type="radio"]:checked {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4) !important;
}
.option-male:has(input[type="radio"]:checked) {
    border-color: #3b82f6 !important;
    background: #eff6ff !important;
    box-shadow: inset 0 0 0 1px #3b82f6 !important;
}

/* Female Option (Pink) */
.option-female:hover {
    border-color: #ec4899 !important;
    background: #fdf2f8 !important;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.15) !important;
}
.option-female input[type="radio"]:checked {
    background: linear-gradient(135deg, #ec4899, #f472b6) !important;
    border-color: transparent !important;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.4) !important;
}
.option-female:has(input[type="radio"]:checked) {
    border-color: #ec4899 !important;
    background: #fdf2f8 !important;
    box-shadow: inset 0 0 0 1px #ec4899 !important;
}

/* Mobile Responsive for Sex Grid */
@media (max-width: 480px) {
    .sex-grid {
        flex-direction: column !important;
    }
}

/* --------------------------------------------------------------------
   Side-by-Side Grid Custom Colors (Yes=Green, No=Red)
   -------------------------------------------------------------------- */
.side-by-side {
    flex-direction: row !important;
}
.side-by-side .custom-option {
    flex: 1;
    text-align: center;
    justify-content: center;
}

/* Option Yes (Green) */
.option-yes:hover {
    border-color: #10B981 !important;
    background: #ecfdf5 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15) !important;
}
.option-yes input[type="radio"]:checked,
.option-yes input[type="checkbox"]:checked {
    background: #10B981 !important;
    border-color: #10B981 !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4) !important;
}
.option-yes:has(input:checked) {
    border-color: #10B981 !important;
    background: #ecfdf5 !important;
    box-shadow: inset 0 0 0 1px #10B981 !important;
}

/* Option No (Red) */
.option-no:hover {
    border-color: #EF4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15) !important;
}
.option-no input[type="radio"]:checked,
.option-no input[type="checkbox"]:checked {
    background: #EF4444 !important;
    border-color: transparent !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4) !important;
}
.option-no:has(input:checked) {
    border-color: #EF4444 !important;
    background: #fef2f2 !important;
    box-shadow: inset 0 0 0 1px #EF4444 !important;
}

/* Mobile Responsive */
@media (max-width: 560px) {
    .side-by-side {
        flex-direction: column !important;
    }
}
