/* ============================================================
   CSS DESIGN TOKENS — Defaults (overridden dynamically by JS)
   ============================================================ */
:root {
    --primary:        #5B5FFB;
    --primary-hover:  #474adb;
    --accent-light:   #f0f1ff;
    --accent-shadow:  rgba(91, 95, 251, 0.22);
    --gradient-end:   #8285ff;

    --bg-color:   #f1f5f9;
    --card-bg:    #ffffff;
    --text-main:  #0f172a;
    --text-muted: #64748b;
    --border:     #e2e8f0;
    --radius:     24px;
    --shadow:     0 20px 48px -12px rgba(0,0,0,0.10), 0 8px 16px -6px rgba(0,0,0,0.04);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(ellipse at 15% 15%, color-mix(in srgb, var(--primary) 10%, transparent) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 85%, color-mix(in srgb, var(--gradient-end) 10%, transparent) 0%, transparent 55%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
    transition: background-color 0.4s;
    -webkit-text-size-adjust: 100%;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-container {
    width: 100%;
    max-width: 430px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.25rem 0.5rem;
}

.logo-placeholder {
    width: 52px; height: 52px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--gradient-end));
    color: white;
    border-radius: 16px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 8px 20px var(--accent-shadow);
    transition: background 0.4s, box-shadow 0.4s;
}

.header-text { display: flex; flex-direction: column; gap: 0.1rem; }

.business-type-label {
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--primary); transition: color 0.4s;
}

#business-name {
    font-size: 1.2rem; font-weight: 700;
    letter-spacing: -0.025em; line-height: 1.2;
}

/* Star rating animation under brand name */
.star-rating-container {
    display: flex;
    gap: 4px;
    margin-top: 0.2rem;
    margin-bottom: 1.5rem;
}

.star-rating-container .star {
    font-size: 1.15rem;
    color: #ffb800;
    opacity: 0;
    transform: scale(0.3) rotate(-15deg);
    animation: starPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Sequential delays: 1 star comes after another has came */
.star-rating-container .star:nth-child(1) { animation-delay: 0.15s; }
.star-rating-container .star:nth-child(2) { animation-delay: 0.35s; }
.star-rating-container .star:nth-child(3) { animation-delay: 0.55s; }
.star-rating-container .star:nth-child(4) { animation-delay: 0.75s; }
.star-rating-container .star:nth-child(5) { animation-delay: 0.95s; }

@keyframes starPopIn {
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.brand-name-ready {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin-bottom: 0.15rem;
}



/* ============================================================
   CARD
   ============================================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.25rem 1.75rem;
    position: relative;
    overflow: hidden;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--gradient-end));
    transition: background 0.4s;
}

/* ============================================================
   STEPS
   ============================================================ */
.step {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.step.active { display: flex; }

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

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h2 {
    font-size: 1.45rem; font-weight: 800;
    margin-bottom: 0.4rem; letter-spacing: -0.03em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem; margin-bottom: 1.75rem; line-height: 1.5;
}

/* ============================================================
   STEP 1 — Thumb Rating
   ============================================================ */
.thumb-container {
    display: flex; gap: 2.5rem;
    justify-content: center; margin-bottom: 0.5rem;
}

.thumb-wrapper {
    display: flex; flex-direction: column;
    align-items: center; gap: 0.6rem;
}

.thumb-btn {
    background: var(--bg-color);
    border: 2px solid var(--border);
    font-size: 2.8rem;
    cursor: pointer;
    width: 88px; height: 88px;
    border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    filter: grayscale(60%) opacity(0.7);
}

.thumb-btn:hover, .thumb-btn.active {
    transform: scale(1.12) translateY(-4px);
    filter: grayscale(0%) opacity(1);
    border-color: var(--primary);
    background-color: var(--accent-light);
    box-shadow: 0 10px 24px var(--accent-shadow);
}

.thumb-label {
    font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
}

/* ============================================================
   STEP 3 — Review Box
   ============================================================ */
.review-box {
    width: 100%;
    background: var(--accent-light);
    border: 1.5px solid color-mix(in srgb, var(--primary) 20%, transparent);
    border-radius: 16px;
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.5rem;
    text-align: left;
    position: relative;
}

.review-box::before {
    content: '"';
    position: absolute; top: -2px; left: 12px;
    font-size: 3rem; font-weight: 800;
    color: var(--primary); opacity: 0.2;
    line-height: 1; font-family: Georgia, serif;
}

#review-text {
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--text-main);
    padding-top: 0.5rem;
}

/* Write-own textarea */
.write-own-area {
    width: 100%;
    margin-bottom: 1.25rem;
    animation: fadeUp 0.3s ease forwards;
}

textarea {
    width: 100%;
    padding: 1rem 1.15rem;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.93rem;
    color: var(--text-main);
    resize: none;
    background: var(--bg-color);
    line-height: 1.65;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

#feedback-text {
    margin-bottom: 1.25rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.action-buttons {
    display: flex; flex-direction: column;
    gap: 0.65rem; width: 100%;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 75%, var(--gradient-end)));
    color: white; border: none;
    padding: 1rem 1.25rem; border-radius: 14px;
    font-size: 1rem; font-weight: 600; width: 100%;
    cursor: pointer; font-family: inherit;
    display: flex; justify-content: center; align-items: center; gap: 0.5rem;
    box-shadow: 0 6px 20px var(--accent-shadow);
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    letter-spacing: -0.01em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--accent-shadow);
}

.primary-btn:active:not(:disabled) { transform: scale(0.98); }

.secondary-btn {
    background: white; color: var(--text-main);
    border: 1.5px solid var(--border);
    padding: 1rem 1.25rem; border-radius: 14px;
    font-size: 0.97rem; font-weight: 600; width: 100%;
    cursor: pointer; font-family: inherit;
    display: flex; justify-content: center; align-items: center; gap: 0.5rem;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

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

.text-btn {
    background: none; border: none;
    color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
    cursor: pointer; font-family: inherit;
    transition: color 0.2s; padding: 0.5rem 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.text-btn.back-btn { margin-top: 0.5rem; }

.text-btn:hover { color: var(--primary); }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
    width: 52px; height: 52px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.85s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
    margin-bottom: 1.75rem; margin-top: 0.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   FEEDBACK & SUCCESS ICONS
   ============================================================ */
.success-icon {
    color: #10b981; margin-bottom: 1.5rem;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.feedback-icon {
    font-size: 3.25rem; margin-bottom: 1rem;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed; bottom: 2rem; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b; color: white;
    padding: 0.8rem 1.4rem; border-radius: 99px;
    font-size: 0.9rem; font-weight: 500;
    opacity: 0; pointer-events: none;
    transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100; box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ============================================================
   FOOTER
   ============================================================ */
.powered-by {
    text-align: center; font-size: 0.72rem;
    color: var(--text-muted); opacity: 0.55;
}

.powered-by span {
    font-weight: 700; color: var(--primary); transition: color 0.4s;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .app-container {
        gap: 1rem;
    }
    .card {
        padding: 2rem 1.25rem;
        min-height: auto;
    }
    h2 {
        font-size: 1.35rem;
    }
}

@media (max-width: 380px) {
    .card { padding: 1.75rem 1.15rem; }
    h2 { font-size: 1.2rem; }
    .subtitle { font-size: 0.85rem; margin-bottom: 1.25rem; }
    .thumb-btn { width: 72px; height: 72px; font-size: 2.2rem; border-radius: 18px; }
    .thumb-container { gap: 1.5rem; }
    .review-box { padding: 1rem; margin-bottom: 1.25rem; }
    textarea { padding: 0.85rem 1rem; }
}

@media (max-width: 320px) {
    .card { padding: 1.5rem 0.85rem; }
    h2 { font-size: 1.1rem; }
    .thumb-btn { width: 64px; height: 64px; font-size: 2rem; border-radius: 16px; }
    .thumb-container { gap: 1rem; }
}
