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

:root {
    --brand-primary: #116dff;
    --brand-secondary: #008afc;
    --brand-accent: #3d9be9;
    --brand-dark: #0a1c3f;
    --brand-light: #f4f8ff;
    --bg-main: #f0f5fc;
    
    --color-din: #8c6239;
    --color-nam: #29abe2;
    --color-lom: #fbb03b;
    --color-fai: #ff5e5e;

    --card-bg: rgba(255, 255, 255, 0.82);
    --card-border: rgba(255, 255, 255, 0.45);
    --card-shadow: 0 20px 50px rgba(10, 28, 63, 0.06);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    
    --transition-smooth: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    font-family: "Sukhumvit Set", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    background-color: var(--bg-main);
    color: var(--brand-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
    padding: 20px;
}

/* Background Animated Shapes */
.app-background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.65;
}

.shape-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(17,109,255,0.2) 0%, rgba(0,138,252,0.1) 70%);
    top: -10%;
    left: -10%;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(61,155,233,0.18) 0%, rgba(17,109,255,0.05) 80%);
    bottom: -15%;
    right: -10%;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0,138,252,0.15) 0%, rgba(255,255,255,0) 70%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 1;
}

/* Header Styles */
.app-header {
    text-align: center;
    padding: 10px 0;
}

.logo-wrapper {
    margin-bottom: 12px;
}

.brand-logo {
    max-height: 70px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(10, 28, 63, 0.08));
}

.brand-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--brand-dark);
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--brand-dark) 30%, var(--brand-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.95rem;
    color: rgba(10, 28, 63, 0.65);
    font-weight: 400;
}

/* Main Card */
.main-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: var(--radius-lg);
    padding: 36px;
    min-height: 400px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Step Animations */
.card-step {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.card-step.active {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    opacity: 1;
    transform: translateY(0);
}

/* Step 1: Welcome */
.step-intro {
    margin-bottom: 28px;
    text-align: center;
}

.step-intro h2 {
    font-size: 1.45rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--brand-dark);
}

.step-intro p {
    font-size: 1rem;
    color: rgba(10, 28, 63, 0.75);
    text-align: justify;
    text-justify: inter-word;
}

/* Form Elements */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0 30px;
}

.input-group label {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--brand-dark);
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select {
    width: 100%;
    padding: 16px 20px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(17, 109, 255, 0.15);
    border-radius: var(--radius-md);
    color: var(--brand-dark);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(10, 28, 63, 0.02);
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(17, 109, 255, 0.12);
    background-color: #fff;
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.8rem;
    color: var(--brand-primary);
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: var(--transition-smooth);
}

.select-wrapper:hover::after {
    transform: translateY(-50%) scale(1.1);
}

.input-helper {
    font-size: 0.85rem;
    color: rgba(10, 28, 63, 0.5);
    font-style: italic;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 24px;
}

.progress-bar-wrapper {
    height: 8px;
    background-color: rgba(17, 109, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    font-size: 0.85rem;
    color: rgba(10, 28, 63, 0.55);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Step 2: Question Container & Instruction */
.assessment-instruction {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(10, 28, 63, 0.65);
    margin-bottom: 16px;
}

.question-card {
    background: rgba(255, 255, 255, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.5), 0 4px 15px rgba(10, 28, 63, 0.02);
}

.question-text {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--brand-dark);
    line-height: 1.5;
}

/* Rating Grid & Option Cards */
.rating-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.rating-card {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(17, 109, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    transition: var(--transition-smooth);
    user-select: none;
}

.rating-card:hover {
    border-color: rgba(17, 109, 255, 0.25);
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(10, 28, 63, 0.04);
}

.rating-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.radio-circle-custom {
    min-width: 22px;
    height: 22px;
    border: 2.5px solid rgba(17, 109, 255, 0.2);
    border-radius: 50%;
    position: relative;
    transition: var(--transition-smooth);
    background: #fff;
}

.rating-card input[type="radio"]:checked ~ .radio-circle-custom {
    border-color: var(--brand-primary);
}

.radio-circle-custom::after {
    content: "";
    position: absolute;
    display: none;
    left: 4px;
    top: 4px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--brand-primary);
}

.rating-card input[type="radio"]:checked ~ .radio-circle-custom::after {
    display: block;
}

.rating-label {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--brand-dark);
    transition: var(--transition-smooth);
}

.rating-card input[type="radio"]:checked ~ .rating-label {
    color: var(--brand-primary);
    font-weight: 700;
}

.rating-card.active-card {
    border-color: var(--brand-primary);
    background: rgba(17, 109, 255, 0.05);
    box-shadow: 0 8px 24px rgba(17, 109, 255, 0.06);
}

/* Button & Action Bar Styles */
.action-bar {
    display: flex;
    gap: 16px;
    margin-top: auto;
    padding-top: 20px;
}

.action-bar.justify-between {
    justify-content: space-between;
}

.action-bar.justify-center {
    justify-content: center;
}

.flex-column {
    flex-direction: column;
}

.gap-3 {
    gap: 12px;
}

.w-full {
    width: 100%;
}

.btn {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(10, 28, 63, 0.04);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(17, 109, 255, 0.25);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: rgba(10, 28, 63, 0.1);
    color: rgba(10, 28, 63, 0.35);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(17, 109, 255, 0.15);
    color: var(--brand-primary);
}

.btn-secondary:hover {
    background: #fff;
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(17, 109, 255, 0.08);
}

/* STEP 3: Result Screen */
.result-header {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 20px;
}

.result-summary-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 245, 252, 0.9) 100%);
    border: 2.5px solid rgba(17, 109, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 25px rgba(10, 28, 63, 0.03);
}

@media(min-width: 576px) {
    .result-summary-box {
        flex-direction: row;
        align-items: center;
    }
}

.summary-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}

.summary-item .label {
    font-size: 0.85rem;
    color: rgba(10, 28, 63, 0.55);
    font-weight: 600;
}

.summary-item .value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.summary-item .value.highlight {
    color: var(--brand-primary);
    font-size: 1.55rem;
    background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(17, 109, 255, 0.1));
}

.summary-divider {
    height: 1px;
    background-color: rgba(17, 109, 255, 0.15);
    width: 100%;
}

@media(min-width: 576px) {
    .summary-divider {
        width: 1.5px;
        height: 50px;
    }
}

/* Radar Chart Section */
.chart-section {
    margin-bottom: 32px;
}

.chart-section h3 {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--brand-dark);
}

.chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

@media(min-width: 576px) {
    .chart-container {
        flex-direction: row;
        justify-content: space-around;
        padding: 0 10px;
    }
}

.svg-chart-wrapper {
    width: 220px;
    height: 220px;
    background-color: #fff;
    border-radius: 50%;
    padding: 10px;
    box-shadow: inset 0 4px 15px rgba(10, 28, 63, 0.03), 0 8px 24px rgba(10, 28, 63, 0.03);
    border: 1px solid rgba(17, 109, 255, 0.08);
}

.radial-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.grid-line {
    fill: none;
    stroke: rgba(10, 28, 63, 0.07);
    stroke-width: 1;
}

.axis-line {
    stroke: rgba(10, 28, 63, 0.12);
    stroke-width: 1;
    stroke-dasharray: 2 2;
}

.chart-label {
    font-size: 9px;
    font-weight: 700;
    fill: var(--brand-dark);
    letter-spacing: -0.2px;
}

.label-din { fill: var(--color-din); }
.label-nam { fill: var(--color-nam); }
.label-lom { fill: var(--color-lom); }
.label-fai { fill: var(--color-fai); }

.chart-polygon {
    fill: rgba(17, 109, 255, 0.22);
    stroke: var(--brand-primary);
    stroke-width: 2.5;
    transition: points 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    filter: drop-shadow(0 4px 8px rgba(17, 109, 255, 0.2));
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 10px;
}

@media(min-width: 480px) {
    .chart-legend {
        grid-template-columns: 1fr;
    }
}

.legend-item {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(10, 28, 63, 0.8);
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}

.color-din { background-color: var(--color-din); }
.color-nam { background-color: var(--color-nam); }
.color-lom { background-color: var(--color-lom); }
.color-fai { background-color: var(--color-fai); }

/* Recommendation Content styling */
.recommendation-box {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid rgba(17, 109, 255, 0.08);
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(10, 28, 63, 0.02);
}

.recom-section {
    margin-bottom: 20px;
}

.recom-section:last-child {
    margin-bottom: 0;
}

.recom-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recom-text {
    font-size: 0.95rem;
    color: rgba(10, 28, 63, 0.8);
    text-align: justify;
    padding-left: 24px;
}

.list-style-custom {
    padding-left: 48px;
    margin-top: 6px;
    font-size: 0.95rem;
    color: rgba(10, 28, 63, 0.8);
}

.list-style-custom li {
    margin-bottom: 4px;
}

/* Call To Action Buttons (Bottom) */
.cta-divider {
    width: 100%;
    text-align: center;
    border-bottom: 1.5px solid rgba(10, 28, 63, 0.08);
    line-height: 0.1em;
    margin: 15px 0 5px;
}

.cta-divider span {
    background: #f7f9fc;
    padding: 0 16px;
    font-size: 0.85rem;
    color: rgba(10, 28, 63, 0.5);
    font-weight: 600;
}

.cta-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
}

@media(min-width: 576px) {
    .cta-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

.btn-cta {
    font-size: 0.9rem;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(10, 28, 63, 0.03);
}

.btn-line {
    background-color: #06c755;
}

.btn-line:hover {
    background-color: #05b04b;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(6, 199, 85, 0.25);
}

.btn-facebook {
    background-color: #1877f2;
}

.btn-facebook:hover {
    background-color: #166fe5;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(24, 119, 242, 0.25);
}

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

.btn-website:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(17, 109, 255, 0.25);
}

/* Footer & Medical Disclaimer */
.app-footer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 10px;
}

.disclaimer {
    background-color: rgba(255, 94, 94, 0.04);
    border: 1.5px solid rgba(255, 94, 94, 0.15);
    border-radius: var(--radius-md);
    padding: 18px 22px;
}

.disclaimer strong {
    color: var(--color-fai);
    font-size: 0.95rem;
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.disclaimer p {
    font-size: 0.85rem;
    color: rgba(10, 28, 63, 0.7);
    line-height: 1.55;
    text-align: justify;
}

.brand-copyright {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(10, 28, 63, 0.45);
    padding-bottom: 20px;
}

.brand-copyright p {
    margin-bottom: 4px;
}

/* LIFF UI Additions */
.liff-status-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(6, 199, 85, 0.05);
    border: 1.5px solid rgba(6, 199, 85, 0.25);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(6, 199, 85, 0.02);
}

.liff-icon {
    font-size: 1.4rem;
}

.liff-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #05b04b;
    line-height: 1.4;
}
