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

:root {
    /* Palette aligned to landing */
    --navy-900: #0f172a;
    --primary-700: #0284C7;
    --primary-600: #0EA5E9;
    --primary-400: #38BDF8;
    --accent-500: #F59E0B;
    --silver-200: rgba(15, 23, 42, 0.14);
    --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: #1f2937;
    --color-text-light: #4b5563;
    --color-bg: #F7F9FB; /* Light, modern bg */
    --color-border: var(--color-silver);
    --color-input-bg: #fcfcfd;

    /* Typography */
    --font-family-system: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
                          Helvetica, Arial, sans-serif, "Apple Color Emoji", 
                          "Segoe UI Emoji", "Segoe UI Symbol";
    --font-family-display: 'Playfair Display', serif;
    
    /* 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(14, 165, 233, 0.12);
}

/* --- 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-flash {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    max-width: 360px;
    width: calc(100% - 2.5rem);
    display: grid;
    gap: 0.65rem;
    z-index: 200;
    pointer-events: none;
}
.survey-flash__item {
    border-radius: var(--radius-m);
    padding: 0.8rem 1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-subtle);
    pointer-events: auto;
    animation: flash-fade 5s ease forwards;
}
.survey-flash__item--success { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.08); }
.survey-flash__item--danger,
.survey-flash__item--error { border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.1); }
.survey-flash__item--warning { border-color: rgba(234,179,8,0.35); background: rgba(234,179,8,0.12); }
.survey-flash__item--info,
.survey-flash__item--message { border-color: rgba(14,165,233,0.3); background: rgba(14,165,233,0.08); }
.survey-flash__item.is-dismissed { opacity: 0; transform: translateY(8px); pointer-events: none; }

@keyframes flash-fade {
    0% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(8px); }
}

.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;
    font-family: var(--font-family-display);
    letter-spacing: -0.01em;
}

.survey-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(14, 165, 233, 0.12);
    color: var(--primary-600);
    border-radius: 999px;
    padding: 0.25rem 0.75rem; /* Reduced padding */
    font-size: 0.8rem; /* Reduced font size */
    font-weight: 600;
}
.survey-chip--muted {
    background: rgba(15, 23, 42, 0.08);
    color: var(--color-text-body);
}

/* --- 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;
    max-width: 64ch;
}

@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-group {
    display: grid;
    gap: 0.4rem;
}

.survey-likert-legend {
    display: grid;
    grid-template-columns: repeat(var(--likert-count, 5), minmax(0, 1fr));
    font-size: 0.85rem;
    color: var(--color-text-light);
    width: 100%;
}

.survey-likert-legend span:first-child {
    grid-column: 1;
    text-align: left;
    justify-self: start;
}

.survey-likert-legend span:last-child {
    grid-column: var(--likert-count, 5);
    text-align: right;
    justify-self: end;
}

.survey-likert {
    display: grid;
    grid-template-columns: repeat(var(--likert-count, 5), minmax(60px, 1fr));
    gap: 0.6rem;
    width: 100%;
}

.survey-option--likert {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    justify-content: center;
    text-align: center;
    padding: 0.65rem 0.5rem;
}

.survey-option--likert span {
    width: 100%;
    font-size: 0.95rem;
}

.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(14, 165, 233, 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(14, 165, 233, 0.4);
}
.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(14, 165, 233, 0.45);
}

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

.styled-select {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--color-text-body);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.35), inset 0 1px 2px rgba(0,0,0,0.04);
    transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.styled-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 12px 32px -18px rgba(14, 165, 233, 0.28), 0 0 0 3px rgba(14, 165, 233, 0.18);
    transform: translateY(-1px);
}
.styled-select option {
    color: var(--color-text-body);
}
}

/* --- 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(14, 165, 233, 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-likert-group {
        gap: 0.35rem;
    }

    .survey-likert {
        grid-template-columns: repeat(var(--likert-count, 5), minmax(48px, 1fr));
        gap: 0.5rem 0.35rem;
    }

    .survey-option--likert {
        padding: 0.6rem 0.45rem;
    }

    .survey-option--likert span {
        font-size: 0.85rem;
        word-break: break-word;
    }

    .survey-likert-legend {
        font-size: 0.8rem;
        line-height: 1.25;
    }

    .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;
    }
}
