/* ============================================================
   CustomerPulse — Design System & Stylesheet
   Version 1.0
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Colors — Core */
    --color-bg:             #F7F8FA;
    --color-surface:        #FFFFFF;
    --color-text-primary:   #1A1A2E;
    --color-text-secondary: #6B7280;
    --color-text-muted:     #9CA3AF;
    --color-border:         #E5E7EB;
    --color-border-light:   #F3F4F6;

    /* Colors — Brand */
    --color-accent:         #E53E3E;
    --color-accent-hover:   #C53030;
    --color-accent-glow:    rgba(229, 62, 62, 0.25);
    --color-navy:           #1A237E;
    --color-navy-light:     #283593;

    /* Colors — Stars */
    --color-star-filled:    #F6AD55;
    --color-star-empty:     #D1D5DB;
    --color-star-hover:     #ED8936;

    /* Colors — Feedback */
    --color-success:        #10B981;
    --color-success-bg:     #ECFDF5;
    --color-error:          #EF4444;
    --color-error-bg:       #FEF2F2;
    --color-info-bg:        #EFF6FF;
    --color-focus:          rgba(59, 130, 246, 0.35);

    /* Typography */
    --font-family:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs:         0.75rem;
    --font-size-sm:         0.8125rem;
    --font-size-base:       0.9375rem;
    --font-size-md:         1rem;
    --font-size-lg:         1.125rem;
    --font-size-xl:         1.5rem;
    --font-size-2xl:        2rem;
    --font-size-3xl:        2.5rem;

    /* Spacing */
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radii */
    --radius-sm:  6px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:  0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg:  0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-xl:  0 8px 30px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 0.15s;
    --duration-base: 0.2s;
    --duration-slow: 0.3s;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Layout ---------- */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* ---------- Header ---------- */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--color-text-primary);
}

.logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    background: #000000;
    border-radius: 10px;
    padding: 5px;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-company {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.logo-tagline {
    font-size: 9.5px;
    font-weight: 500;
    color: #E53E3E;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.header-meta svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* ---------- Hero ---------- */
.hero {
    text-align: center;
    padding: var(--space-12) 0 var(--space-8);
    animation: fadeInUp 0.6s var(--ease-default) both;
}

.hero-badge {
    display: inline-block;
    background: var(--color-border-light);
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--space-2) var(--space-4);
    border-radius: 100px;
    margin-bottom: var(--space-5);
}

.hero h1 {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

.hero p {
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ---------- Progress ---------- */
.progress-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    animation: fadeInUp 0.6s var(--ease-default) 0.1s both;
}

.progress-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.progress-count {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.progress-track {
    width: 100%;
    height: 4px;
    background: var(--color-border);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: var(--space-8);
    animation: fadeInUp 0.6s var(--ease-default) 0.15s both;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), #F56565);
    border-radius: 100px;
    transition: width 0.5s var(--ease-default);
}

/* ---------- Questions Card ---------- */
.questions-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-8) var(--space-8);
    margin-bottom: var(--space-8);
    animation: fadeInUp 0.6s var(--ease-default) 0.2s both;
}

/* ---------- Single Question ---------- */
.question-item {
    padding: var(--space-6) 0;
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--duration-base) var(--ease-default);
}

.question-item:first-child {
    padding-top: 0;
}

.question-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.question-item.answered {
    /* subtle answered state */
}

.question-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.question-number {
    width: 36px;
    height: 36px;
    background: var(--color-navy);
    color: #fff;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    flex-shrink: 0;
    transition: transform var(--duration-base) var(--ease-default),
                background var(--duration-base) var(--ease-default);
}

.question-item.answered .question-number {
    background: var(--color-success);
    transform: scale(1.05);
}

.question-text h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
    line-height: 1.4;
}

.question-text p {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ---------- Star Rating ---------- */
.star-rating {
    display: flex;
    gap: var(--space-2);
    padding-left: calc(36px + var(--space-4));
}

.star-rating .star {
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default);
    color: var(--color-star-empty);
    font-size: 1.75rem;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
}

.star-rating .star:hover {
    transform: scale(1.2);
}

.star-rating .star.hovered {
    color: var(--color-star-hover);
}

.star-rating .star.selected {
    color: var(--color-star-filled);
}

.star-rating .star svg {
    width: 28px;
    height: 28px;
    display: block;
    fill: currentColor;
    transition: fill var(--duration-fast) var(--ease-default),
                transform var(--duration-fast) var(--ease-default);
}

.star-rating .star:hover svg {
    transform: scale(1.15);
}

/* ---------- Textarea (Text Question) ---------- */
.text-answer-wrap {
    padding-left: calc(36px + var(--space-4));
}

.text-answer-wrap textarea {
    width: 100%;
    min-height: 120px;
    padding: var(--space-4);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    resize: vertical;
    transition: border-color var(--duration-base) var(--ease-default),
                box-shadow var(--duration-base) var(--ease-default);
    background: var(--color-bg);
    line-height: 1.6;
}

.text-answer-wrap textarea::placeholder {
    color: var(--color-text-muted);
}

.text-answer-wrap textarea:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px var(--color-focus);
    background: var(--color-surface);
}

.char-counter {
    text-align: right;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-2);
    transition: color var(--duration-base) var(--ease-default);
}

.char-counter.near-limit {
    color: var(--color-star-hover);
}

.char-counter.at-limit {
    color: var(--color-error);
    font-weight: 600;
}

/* ---------- About You Section ---------- */
.about-section {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    animation: fadeInUp 0.6s var(--ease-default) 0.3s both;
}

.about-section .section-label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.about-section .section-sublabel {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.form-group input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    transition: border-color var(--duration-base) var(--ease-default),
                box-shadow var(--duration-base) var(--ease-default);
    background: var(--color-bg);
}

.form-group input::placeholder {
    color: var(--color-text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px var(--color-focus);
    background: var(--color-surface);
}

.anon-note {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-style: italic;
}

/* ---------- Submit ---------- */
.submit-section {
    text-align: center;
    margin-bottom: var(--space-10);
    animation: fadeInUp 0.6s var(--ease-default) 0.35s both;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-accent);
    color: #fff;
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    font-weight: 700;
    padding: var(--space-4) var(--space-10);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-base) var(--ease-default),
                transform var(--duration-base) var(--ease-default),
                box-shadow var(--duration-base) var(--ease-default);
    letter-spacing: 0.02em;
}

.btn-submit:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--color-accent-glow);
}

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

@keyframes pulse-subtle {
    0%, 100% { box-shadow: 0 0 0 0 var(--color-accent-glow); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

.btn-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-accent-glow);
}

/* ---------- Validation Error ---------- */
.validation-error {
    display: none;
    background: var(--color-error-bg);
    color: var(--color-error);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-4);
    text-align: center;
    animation: shake 0.4s var(--ease-default);
}

.validation-error.visible {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
}

/* ---------- Trust Badges ---------- */
.trust-badges {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-12);
    animation: fadeInUp 0.6s var(--ease-default) 0.4s both;
}

.trust-badge {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-4);
    text-align: center;
    transition: border-color var(--duration-base) var(--ease-default),
                box-shadow var(--duration-base) var(--ease-default),
                transform var(--duration-base) var(--ease-default);
}

.trust-badge:hover {
    border-color: var(--color-text-muted);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.trust-badge-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-2);
    display: block;
}

.trust-badge-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.trust-badge-desc {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: var(--space-8) 0 var(--space-10);
    border-top: 1px solid var(--color-border);
}

.site-footer p {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* ---------- Thank You Page ---------- */
.thankyou-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 160px);
    padding: var(--space-8) 0;
}

.thankyou-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    max-width: 520px;
    width: 100%;
    animation: fadeInUp 0.6s var(--ease-default) both;
}

/* Animated Checkmark */
.checkmark-circle {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--color-success-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-8);
    animation: scaleIn 0.5s var(--ease-default) 0.2s both;
}

.checkmark-circle svg {
    width: 40px;
    height: 40px;
}

.checkmark-circle .checkmark-path {
    stroke: var(--color-success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: drawCheck 0.5s var(--ease-default) 0.6s forwards;
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.thankyou-card h1 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

.thankyou-card p {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-8);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-border-light);
    color: var(--color-text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    transition: background var(--duration-base) var(--ease-default),
                transform var(--duration-base) var(--ease-default);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--color-border);
    transform: translateY(-1px);
}

/* ---------- Flash Messages ---------- */
.flash-error {
    background: var(--color-error-bg);
    color: var(--color-error);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-6);
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .container {
        padding: 0 var(--space-4);
    }

    .header-inner {
        padding: 0 var(--space-4);
    }

    .header-meta span.meta-text {
        display: none;
    }

    .hero h1 {
        font-size: var(--font-size-2xl);
    }

    .hero {
        padding: var(--space-8) 0 var(--space-6);
    }

    .questions-card {
        padding: var(--space-5) var(--space-5);
    }

    .about-section {
        padding: var(--space-5);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .trust-badges {
        grid-template-columns: 1fr;
    }

    .star-rating {
        padding-left: calc(36px + var(--space-3));
    }

    .text-answer-wrap {
        padding-left: calc(36px + var(--space-3));
    }

    .question-header {
        gap: var(--space-3);
    }

    .btn-submit {
        width: 100%;
        justify-content: center;
    }

    .thankyou-card {
        padding: var(--space-8) var(--space-5);
    }
}

@media (max-width: 380px) {
    .star-rating {
        padding-left: 0;
        justify-content: center;
    }

    .text-answer-wrap {
        padding-left: 0;
    }

    .question-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
