/* ============================================
   ALTORIA MARKETING — SURVEY APP STYLES
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #000000;
    --bg-elevated: #0a0a0a;
    --bg-card: #0d0d0d;
    --bg-input: #121212;
    --bg-input-focus: #161616;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --border-focus: rgba(52, 235, 154, 0.55);
    --text: #ffffff;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    /* Green accent */
    --accent: #34eb9a;
    --accent-dim: rgba(52, 235, 154, 0.15);
    --accent-glow: rgba(52, 235, 154, 0.25);

    /* Blue accent */
    --accent-blue: #3B82F6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-blue-glow: rgba(59, 130, 246, 0.25);
    --accent-blue-border: rgba(59, 130, 246, 0.25);

    --error: #ff5c7a;
    --error-bg: rgba(255, 92, 122, 0.08);
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 20px 60px -20px rgba(0, 0, 0, 0.8),
                   0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    --shadow-accent: 0 10px 30px -8px rgba(52, 235, 154, 0.35);
    --transition: 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 900px;
    background: radial-gradient(circle at center,
                rgba(52, 235, 154, 0.06) 0%,
                rgba(52, 235, 154, 0.02) 30%,
                transparent 60%);
    pointer-events: none;
    z-index: 0;
    filter: blur(40px);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ============================================
   LAYOUT
   ============================================ */
.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 20px 80px;
}

.logo-wrapper {
    width: 100%;
    max-width: 640px;
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
    opacity: 0;
    animation: fadeSlideDown 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.logo-wrapper img {
    max-width: 260px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(52, 235, 154, 0.08));
}

/* When there's no brand logo below, restore original bottom spacing */
.logo-wrapper:last-of-type {
    margin-bottom: 56px;
}

/* ============================================
   BRAND LOGO (per-survey, sits BELOW the Altoria logo)
   The source image has substantial internal whitespace, so we use
   negative margins to pull the surrounding content closer.
   ============================================ */
.brand-logo-wrapper {
    width: 100%;
    max-width: 640px;
    display: flex;
    justify-content: center;
    /* Pull the wrapper up into the image's top whitespace, but stay clear of
       the Altoria logo above (which has 28px bottom margin) */
    margin-top: -20px;
    /* Pull the next block up into the image's bottom whitespace */
    margin-bottom: -20px;
    opacity: 0;
    animation: fadeSlideDown 700ms cubic-bezier(0.22, 1, 0.36, 1) 150ms forwards;
}

.brand-logo-wrapper img {
    max-width: 360px;
    width: 100%;
    height: auto;
    /* Source image has a black background — blends seamlessly on our black page */
}

.screen {
    width: 100%;
    max-width: 640px;
    display: none;
}

.screen.active {
    display: block;
    animation: fadeSlideUp 600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ============================================
   CARD
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
                transparent,
                rgba(52, 235, 154, 0.4),
                transparent);
}

/* ============================================
   HEADERS
   ============================================ */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-blue);
    padding: 6px 12px;
    background: var(--accent-blue-dim);
    border: 1px solid var(--accent-blue-border);
    border-radius: 999px;
    margin-bottom: 20px;
}

.eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--accent-blue);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-blue);
    animation: pulse 2s ease-in-out infinite;
}

.screen-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 12px;
}

.screen-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 36px;
    font-weight: 400;
}

.screen-description {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
    font-weight: 400;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
    opacity: 0.92;
}

.survey-header .screen-description + .screen-subtitle {
    margin-bottom: 0;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.01em;
}

.field input,
.field textarea {
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    outline: none;
    transition: all var(--transition);
    width: 100%;
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--text-dim);
}

.field input:hover,
.field textarea:hover {
    border-color: var(--border-strong);
    background: var(--bg-input-focus);
}

.field input:focus,
.field textarea:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 4px rgba(52, 235, 154, 0.08);
}

.field input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
}

.field.error input,
.field.error textarea {
    border-color: var(--error);
    background: var(--error-bg);
}

.error-msg {
    font-size: 12px;
    color: var(--error);
    margin-top: 2px;
    display: none;
    letter-spacing: -0.01em;
}

.field.error .error-msg {
    display: block;
    animation: shake 300ms ease-out;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 16px 28px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent);
    color: #00140b;
    box-shadow: var(--shadow-accent);
    width: 100%;
    margin-top: 28px;
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
                transparent 30%,
                rgba(255, 255, 255, 0.25) 50%,
                transparent 70%);
    transform: translateX(-100%);
    transition: transform 600ms ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px -10px rgba(52, 235, 154, 0.5);
}

.btn-primary:hover::after {
    transform: translateX(100%);
}

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

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

.btn-primary .arrow {
    transition: transform var(--transition);
}

.btn-primary:hover .arrow {
    transform: translateX(4px);
}

/* ============================================
   SURVEY
   ============================================ */
.survey-header {
    text-align: center;
    margin-bottom: 40px;
}

.survey-header .screen-title {
    font-size: 36px;
    margin-bottom: 10px;
}

.survey-header .screen-subtitle {
    margin-bottom: 0;
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.question {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: border-color var(--transition), background var(--transition);
    position: relative;
    opacity: 0;
    transform: translateY(16px);
    animation: fadeSlideUp 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.question:hover {
    border-color: var(--border-strong);
}

.question-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.question-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-blue);
    letter-spacing: 0.08em;
    background: var(--accent-blue-dim);
    border: 1px solid var(--accent-blue-border);
    padding: 4px 10px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-top: 2px;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.question-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.45;
}

.question-unsupported {
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
}

/* Category divider */
.category-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 4px 2px;
    margin-top: 22px;
    margin-bottom: 4px;
    opacity: 0;
    transform: translateY(8px);
    animation: fadeSlideUp 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.category-divider:first-child {
    margin-top: 0;
}

.category-divider::before,
.category-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.category-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-blue);
    padding: 4px 12px;
    background: var(--accent-blue-dim);
    border: 1px solid var(--accent-blue-border);
    border-radius: 999px;
    white-space: nowrap;
}

/* ============================================
   STAR RATING
   ============================================ */
.stars {
    display: flex;
    gap: 6px;
    padding-left: 2px;
}

.star {
    width: 42px;
    height: 42px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-dim);
}

.star svg {
    width: 20px;
    height: 20px;
    transition: all var(--transition);
}

.star:hover {
    border-color: var(--border-strong);
    background: var(--bg-input-focus);
    transform: translateY(-2px);
}

.star.active,
.star.hover-fill {
    background: var(--accent-dim);
    border-color: rgba(52, 235, 154, 0.4);
    color: var(--accent);
}

.star.active svg {
    fill: var(--accent);
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.star.hover-fill svg {
    fill: var(--accent);
    opacity: 0.7;
}

/* ============================================
   CHIPS
   ============================================ */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    letter-spacing: -0.01em;
}

.chip:hover {
    border-color: var(--border-strong);
    background: var(--bg-input-focus);
    color: var(--text);
    transform: translateY(-1px);
}

.chip.selected {
    background: var(--accent-dim);
    border-color: rgba(52, 235, 154, 0.4);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(52, 235, 154, 0.2) inset;
}

.chip.selected::before {
    content: "✓";
    margin-right: 6px;
    font-weight: 700;
}

/* ============================================
   TEXTAREA (in survey questions)
   ============================================ */
.question textarea {
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    width: 100%;
    min-height: 100px;
    resize: vertical;
    outline: none;
    transition: all var(--transition);
    line-height: 1.55;
    font-weight: 400;
}

.question textarea::placeholder {
    color: var(--text-dim);
}

.question textarea:hover {
    border-color: var(--border-strong);
    background: var(--bg-input-focus);
}

.question textarea:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 4px rgba(52, 235, 154, 0.08);
}

/* ============================================
   THANK YOU
   ============================================ */
.thankyou {
    text-align: center;
    padding: 60px 30px;
}

.thankyou-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    background: var(--accent-dim);
    border: 1px solid rgba(52, 235, 154, 0.3);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    box-shadow: 0 0 40px rgba(52, 235, 154, 0.2);
    animation: popIn 600ms cubic-bezier(0.22, 1.36, 0.36, 1) 200ms backwards;
}

.thankyou h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.thankyou p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ============================================
   ERROR PAGE
   ============================================ */
.error-card {
    text-align: center;
    padding: 60px 30px;
}

.error-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    background: var(--error-bg);
    border: 1px solid rgba(255, 92, 122, 0.3);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
    box-shadow: 0 0 40px rgba(255, 92, 122, 0.15);
    animation: popIn 600ms cubic-bezier(0.22, 1.36, 0.36, 1) 100ms backwards;
}

.error-card h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.error-card p {
    color: var(--text-muted);
    font-size: 15px;
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.55;
}

.error-code {
    display: inline-block;
    margin-top: 20px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* ============================================
   QUESTION VALIDATION
   ============================================ */
.question-error-msg {
    display: none;
    margin-top: 12px;
    font-size: 13px;
    color: var(--error);
    font-weight: 500;
    letter-spacing: -0.01em;
}

.question.unanswered {
    border-color: rgba(255, 92, 122, 0.4);
    background: linear-gradient(180deg, rgba(255, 92, 122, 0.04), var(--bg-card) 50%);
    animation: shake 350ms ease-out;
    opacity: 1;
    transform: none;
}

.question.unanswered .question-error-msg {
    display: block;
}

.question.unanswered .question-number {
    background: rgba(255, 92, 122, 0.15);
    border-color: rgba(255, 92, 122, 0.3);
    color: var(--error);
}

.question.entered {
    animation: none;
    opacity: 1;
    transform: none;
}

.question.entered.unanswered {
    animation: shake 350ms ease-out;
    opacity: 1;
    transform: none;
}

/* Top-of-survey toast */
.toast-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(255, 92, 122, 0.08);
    border: 1px solid rgba(255, 92, 122, 0.3);
    border-radius: var(--radius);
    color: var(--error);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    overflow: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition:
        opacity 250ms ease,
        transform 250ms ease,
        max-height 250ms ease,
        margin 250ms ease,
        padding 250ms ease,
        border-width 250ms ease;
    position: sticky;
    top: 16px;
    z-index: 5;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast-error.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    max-height: 80px;
    margin-bottom: 20px;
    padding-top: 14px;
    padding-bottom: 14px;
    border-width: 1px;
}

.toast-error svg {
    flex-shrink: 0;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .app {
        padding: 32px 16px 60px;
    }

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

    .logo-wrapper:last-of-type {
        margin-bottom: 40px;
    }

    .logo-wrapper img {
        max-width: 200px;
    }

    .brand-logo-wrapper {
        margin-top: -16px;
        margin-bottom: -16px;
    }

    .brand-logo-wrapper img {
        max-width: 280px;
    }

    .card {
        padding: 28px 22px;
        border-radius: 18px;
    }

    .screen-title {
        font-size: 26px;
    }

    .survey-header .screen-title {
        font-size: 28px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .question {
        padding: 22px 20px;
        border-radius: 18px;
    }

    .question-text {
        font-size: 15px;
    }

    .star {
        width: 38px;
        height: 38px;
    }

    .star svg {
        width: 18px;
        height: 18px;
    }

    .chip {
        font-size: 13px;
        padding: 9px 14px;
    }

    .category-label {
        font-size: 10px;
        padding: 3px 10px;
    }
}

@media (max-width: 380px) {
    .stars {
        gap: 4px;
    }

    .star {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

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

    .brand-logo-wrapper img {
        max-width: 240px;
    }
}

.hidden {
    display: none !important;
}
