:root {
    --primary-color: #4f46e5;
    /* Slightly deeper indigo for professional look */
    --secondary-color: #7c3aed;
    --background-gradient: #f8fafc;
    /* Light gray background (darkened white < 20%) */
    --card-bg: #ffffff;
    --text-color: #111827;
    --text-light: #4b5563;
    --option-bg: #f3f4f6;
    --option-hover: #e5e7eb;
    --d-color: #ef4444;
    --i-color: #eab308;
    --s-color: #22c55e;
    --c-color: #3b82f6;
}

* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    /* Prevent horizontal scroll globally */
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

p {
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Wizard & Progress */
.progress-container {
    margin-bottom: 2rem;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* Test Interface Logic - CRITICAL for Pagination */
.question-step {
    display: none;
    animation: fadeIn 0.5s ease;
}

.question-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Test Interface Enhancements */
.question-card,
.card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

.question-header {
    margin-bottom: 2rem;
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #f3f4f6;
    /* Separator line */
}

.question-number {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-color);
    /* Highlight number */
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: #eef2ff;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

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

/* Option Cards Enhanced */
.option-card {
    display: grid;
    /* Restore Grid for DISC layout */
    grid-template-columns: 1fr auto auto;
    /* Text | Most | Least */
    align-items: center;
    gap: 1rem;
    /* Add gap between columns */
    padding: 1.25rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

/* Personality Test might use option-card too, but with different content. 
       If it has only 1 child, grid will still work (1st col). 
       But let's ensure it doesn't break. */

.option-card:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Selected State */
.option-card.selected-most {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.option-card.selected-least {
    border-color: var(--d-color);
    background: #fef2f2;
}

.selection-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 0.5rem;
    cursor: pointer;
}

.selection-area input[type="radio"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin: 0;
}

.selection-label {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}

/* Focus State for Accessibility */
.option-item:focus-within,
.option-card:focus-within {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Navigation Buttons Enhanced */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    gap: 1.5rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    letter-spacing: 0.025em;
    color: white !important;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    /* Ensure background is present */
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-block;
}

.btn:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Reusable Button Classes */
.btn-next {
    background: #3b82f6 !important;
    /* Soft Blue (Tailwind Blue-500) */
    color: white !important;
}

.btn-next:hover {
    background: #2563eb !important;
    /* Darker Blue on Hover */
}

.btn-submit {
    background: linear-gradient(to right, #10b981, #059669);
    /* Emerald Green for Submit */
    color: white !important;
}

/* Validation Warning */
.validation-warning {
    color: #ef4444;
    /* Red-500 */
    background-color: #fef2f2;
    /* Red-50 */
    border: 1px solid #fecaca;
    /* Red-200 */
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    /* Hidden by default */
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.btn-secondary {
    background: white;
    color: #4b5563 !important;
    /* Force dark text */
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827 !important;
    transform: translateY(-2px);
}

/* Result Page */
.result-summary {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    margin-bottom: 1rem;
}

.bg-D {
    background-color: var(--d-color);
}

.bg-I {
    background-color: var(--i-color);
}

.bg-S {
    background-color: var(--s-color);
}

.bg-C {
    background-color: var(--c-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

.communication-section {
    margin-top: 2rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 2rem;
}

.comm-box {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.comm-box h3 {
    margin-top: 0;
    color: var(--text-color);
    font-size: 1.1rem;
}

ul {
    padding-left: 1.5rem;
    margin-bottom: 0;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

/* Responsive */
/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    /* Stack option card content on mobile for better readability */
    .option-card {
        grid-template-columns: 1fr;
        /* Stack vertically */
        gap: 1rem;
        text-align: center;
    }

    /* Create a sub-grid or flex container for the Most/Least buttons to keep them side-by-side */
    .option-card>.selection-area {
        display: inline-flex;
        /* Keep them inline */
    }

    /* We need to restructure the grid for mobile if we want Text on top, and Most/Least below side-by-side */
    /* Actually, the HTML structure is flat: Text, Div(Most), Div(Least) */
    /* So grid-template-columns: 1fr 1fr; with Text spanning 2 cols? */

    .option-card {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "text text"
            "most least";
    }

    .option-text {
        grid-area: text;
        margin-bottom: 0.5rem;
    }

    .selection-area:nth-of-type(1) {
        /* This selector might be tricky if there are other divs */
        /* The HTML is: .option-text, .selection-area (Most), .selection-area (Least) */
        grid-area: most;
        justify-self: center;
    }

    .selection-area:nth-last-child(1) {
        grid-area: least;
        justify-self: center;
    }
}