/* --- Career Compass Survey --- */
/* Compact Redesign */

:root {
    /* Palette */
    --navy-900: #0d2040;
    --primary-700: #2348c6;
    --primary-600: #2f67f6;
    --primary-400: #5f8cff;
    --accent-500: #f2a541;
    --silver-200: rgba(0, 43, 73, 0.16);
    --white: #FFFFFF;

    --color-navy: var(--navy-900);
    --color-primary: var(--primary-600);
    --color-accent: var(--color-primary);
    --color-silver: var(--silver-200);
    --color-white: var(--white);

    /* Semantic Colors */
    --color-text-header: var(--color-navy);
    --color-text-body: #38566F;
    --color-text-light: #6C7F91;
    --color-bg: #F7F9FB; /* Light, modern bg */
    --color-border: var(--color-silver);
    --color-input-bg: #fcfcfd;

    /* Typography */
    --font-family-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
                          Helvetica, Arial, sans-serif, "Apple Color Emoji", 
                          "Segoe UI Emoji", "Segoe UI Symbol";
    
    /* Layout (More compact radii) */
    --radius-s: 6px;
    --radius-m: 8px;
    --radius-l: 12px;
    --radius-xl: 20px; /* Reduced from 24px */
    --shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-medium: 0 8px 32px rgba(0, 43, 73, 0.1);
}

/* --- Base & Body --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.survey-body {
    min-height: 100vh;
    font-family: var(--font-family-system);
    background-color: var(--color-bg);
    color: var(--color-text-body);
    line-height: 1.5; /* Reduced line-height */
}

.survey-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2.5rem; /* Reduced padding */
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Reduced gap */
}

/* --- Glassmorphism Effect --- */
.glass {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- Survey Header --- */
.survey-header {
    padding: 1.25rem; /* Reduced padding */
    border-radius: var(--radius-xl);
    color: var(--color-text-header);
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Reduced gap */
    box-shadow: var(--shadow-medium);
}

.survey-header h1 {
    font-size: clamp(1.6rem, 4vw, 2rem); /* Reduced font size */
    font-weight: 700;
    letter-spacing: -0.01em;
}

.survey-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(47, 103, 246, 0.12);
    color: var(--primary-400);
    border-radius: 999px;
    padding: 0.25rem 0.75rem; /* Reduced padding */
    font-size: 0.8rem; /* Reduced font size */
    font-weight: 600;
}

/* --- Progress Bar --- */
.survey-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.survey-progress-bar {
    width: 100%;
    height: 8px; /* Reduced height */
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
}

.survey-progress-fill {
    width: 0;
    height: 100%;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.survey-progress-label {
    font-size: 0.85rem; /* Reduced font size */
    color: var(--color-text-light);
}

/* --- Section Pill/Desc --- */
.survey-section-pill {
    display: inline-block;
    align-self: flex-start;
    padding: 4px 12px;
    background: rgba(13, 32, 64, 0.08);
    color: var(--color-navy);
    border-radius: 999px;
    font-size: 0.8rem; /* Reduced font size */
    font-weight: 600;
    margin-top: 0.25rem; /* Reduced margin */
}

.survey-section-desc {
    font-size: 0.85rem; /* Reduced font size */
    color: var(--color-text-light);
    margin-top: 0.25rem;
}

/* --- Main Content Card --- */
.survey-main {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 1.5rem; /* Reduced padding */
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Reduced gap */
}

.survey-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Reduced gap */
}

.survey-question-stack {
    position: relative;
    /* Removed min-height for compactness */
}

/* --- Question Card --- */
.survey-question-card {
    display: none;
    background: var(--color-white);
    border-radius: var(--radius-l);
    border: 1px solid var(--color-border);
    padding: 1.25rem; /* Reduced padding */
    gap: 1.25rem; /* Reduced gap */
}

.survey-question-card.is-active {
    display: grid;
    animation: surveyFade 0.35s ease both;
}

.survey-question-card.has-error {
    border-color: rgba(220, 38, 38, 0.55);
    box-shadow: 0 4px 12px -8px rgba(220, 38, 38, 0.45);
}

.survey-question-card--intro {
    display: none;
    gap: 0.4rem;
}
.survey-question-card--intro.is-active {
    display: grid;
}

.survey-intro-heading {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.survey-question-card--intro h2 {
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
}

.survey-question-header h2 {
    font-size: 1.2rem; /* Reduced font size */
    color: var(--color-text-header);
    font-weight: 600;
}

.survey-question-helper {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

@keyframes surveyFade {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Inputs --- */
.survey-inputs {
    display: grid;
    gap: 0.5rem; /* Reduced gap */
}

.survey-prelude-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.survey-prelude-card {
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-m);
    padding: 0.9rem 1rem;
    display: grid;
    gap: 0.5rem;
}
.survey-prelude-card.compact h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--color-text-header);
}

.survey-prelude-list {
    margin: 0;
    padding-left: 1.25rem;
    display: grid;
    gap: 0.25rem;
}

.survey-prelude-card p {
    margin: 0;
    color: var(--color-text-body);
}

.survey-prelude-highlight {
    font-weight: 700;
    color: var(--color-text-header);
}

.survey-prelude-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-weight: 600;
    color: var(--color-text-header);
    font-size: 0.95rem;
}

.survey-prelude-actions {
    display: flex;
    justify-content: flex-end;
    position: sticky;
    top: 0;
    padding: 0.25rem 0 0.5rem;
    background: linear-gradient(180deg, rgba(252, 252, 253, 0.96) 0%, rgba(252, 252, 253, 0) 90%);
    z-index: 2;
}

.survey-btn.survey-prelude-start {
    width: auto;
    height: auto;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-l);
    gap: 0.5rem;
    font-weight: 700;
}

.survey-option {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem; /* Reduced padding */
    border-radius: var(--radius-m);
    border: 1px solid var(--color-border);
    background: var(--color-input-bg);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.survey-option:hover {
    transform: translateY(-2px);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-subtle);
}

.survey-option:has(input:checked) {
    border-color: var(--color-accent);
    background-color: var(--color-white);
}

.survey-option input {
    accent-color: var(--color-accent);
}

.survey-option span {
    color: var(--color-text-body);
}

.survey-option input:checked + span {
    font-weight: 600;
    color: var(--color-text-header);
}

.survey-likert {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: space-between;
}

.survey-option--likert {
    flex: 1 1 120px;
    justify-content: center;
    text-align: center;
}

.survey-option--likert span {
    width: 100%;
}

.survey-likert-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 0.4rem;
}

.survey-input,
.survey-textarea {
    width: 100%;
    border-radius: var(--radius-m);
    border: 1px solid var(--color-border);
    padding: 0.75rem 1rem; /* Reduced padding */
    font-size: 1rem;
    font-family: var(--font-family-system);
    background-color: var(--color-input-bg);
    transition: all 0.2s ease;
}

.survey-input:focus,
.survey-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(47, 103, 246, 0.2);
    background-color: var(--color-white);
}

.survey-scale {
    display: grid;
    gap: 0.6rem;
    padding: 0.5rem 0.25rem;
}

.survey-scale input[type="range"] {
    width: 100%;
    accent-color: var(--color-accent);
}

.survey-scale-labels {
    display: flex;
    justify-content: space-between;
    color: var(--color-text-light);
    font-size: 0.85rem;
}

.survey-error {
    min-height: 1rem;
    font-size: 0.85rem;
    color: #dc2626;
    font-weight: 500;
}

/* --- NEW Controls & Buttons --- */
.survey-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem; /* Removed border/padding, just add margin */
    position: sticky;
    bottom: 0;
    padding: 0.75rem 0;
    background: linear-gradient(180deg, rgba(247, 247, 249, 0) 0%, rgba(247, 247, 249, 0.9) 30%, rgba(247, 247, 249, 1) 60%);
    z-index: 10;
}

.survey-controls-right {
    display: flex;
    gap: 1rem;
}

.survey-btn {
    /* Circular button styles */
    width: 44px;  /* 44px is a good touch target size */
    height: 44px;
    border-radius: 50%; 
    padding: 0; /* Remove padding */
    
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0; /* No gap needed for single icon */
    
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.survey-btn i {
    font-size: 1rem; /* Adjust icon size */
}

.survey-btn:hover {
    transform: translateY(-2px);
}

.survey-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Default/Next Button */
.survey-btn {
    background: var(--color-navy);
    color: var(--color-white);
    box-shadow: 0 6px 18px -6px rgba(13, 32, 64, 0.35);
}
.survey-btn:hover:not(:disabled) {
    background-color: #0a1833;
    box-shadow: 0 12px 30px -10px rgba(13, 32, 64, 0.45);
}

/* Ghost/Previous Button */
.survey-btn--ghost {
    background: var(--color-white);
    color: var(--color-text-header);
    border-color: rgba(13, 32, 64, 0.22);
    box-shadow: none;
}
.survey-btn--ghost:hover:not(:disabled) {
    background-color: var(--color-bg);
    border-color: rgba(13, 32, 64, 0.35);
}

/* Primary/Submit Button */
.survey-btn--primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: var(--color-white);
    border-color: transparent;
    box-shadow: 0 14px 34px -18px rgba(35, 72, 198, 0.65);
}
.survey-btn--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    border-color: transparent;
    box-shadow: 0 18px 38px -18px rgba(35, 72, 198, 0.7);
}

.survey-btn.is-hidden {
    display: none;
}

/* --- Loading Spinner (Updated) --- */
.survey-btn.is-loading {
    position: relative;
}

.survey-btn.is-loading i {
    visibility: hidden; /* Hide icon */
}

.survey-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 0; bottom: 0; left: 0; right: 0;
    margin: auto;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: var(--color-white);
    animation: surveySpin 0.6s linear infinite;
}

.survey-btn--ghost.is-loading::after {
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: var(--color-navy);
}

@keyframes surveySpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Toast Notification --- */
.survey-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 0.85rem 1.2rem;
    border-radius: var(--radius-m);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1000;
}

.survey-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.survey-toast--error { background: rgba(220, 38, 38, 0.9); }
.survey-toast--success { background: rgba(47, 103, 246, 0.9); }

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

    .survey-header,
    .survey-main {
        border-radius: var(--radius-l);
        padding: 1.1rem;
    }

    .survey-main {
        position: relative;
        padding-left: 3.1rem;
        padding-right: 3.1rem;
    }

    .survey-question-card {
        padding: 1rem;
        gap: 0.9rem;
    }

    .survey-question-header h2 {
        font-size: 1.05rem;
    }

    .survey-question-helper {
        font-size: 0.85rem;
    }

    .survey-option {
        padding: 0.65rem 0.75rem;
    }

    .survey-option span {
        font-size: 0.95rem;
    }

    .survey-controls {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.65rem 0.3rem;
        align-items: center;
        transform: none;
        pointer-events: auto;
        background: linear-gradient(180deg, rgba(247, 247, 249, 0) 0%, rgba(247, 247, 249, 0.9) 35%, rgba(247, 247, 249, 1) 70%);
        z-index: 15;
    }

    .survey-controls-right {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

    .survey-btn {
        width: 44px; /* Maintain circular shape */
        pointer-events: auto;
    }

    .survey-controls-right .survey-btn {
        width: 44px;
    }
}
