/* =========================================================
   STEPIFY AI — Design System
   ========================================================= */

:root {
    /* Brand palette */
    --indigo:   #4f46e5;
    --violet:   #7c3aed;
    --sky:      #0ea5e9;
    --pink:     #ec4899;
    --rose:     #f43f5e;

    /* Ink */
    --ink:      #0f172a;
    --ink-soft: #334155;
    --muted:    #64748b;

    /* Surfaces */
    --glass:        rgba(255, 255, 255, 0.55);
    --glass-strong: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.70);
    --ring:         rgba(79, 70, 229, 0.35);

    /* Effects */
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 14px 40px rgba(30, 41, 90, 0.14);
    --shadow-lg: 0 24px 60px rgba(30, 41, 90, 0.20);
    --radius:    22px;
    --radius-sm: 14px;

    --grad-brand:  linear-gradient(135deg, var(--indigo), var(--violet) 55%, var(--pink));
    --grad-title:  linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899, #4f46e5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(900px 600px at 12% -5%, #ede9fe 0%, transparent 55%),
        radial-gradient(900px 600px at 95% 5%,  #dbeafe 0%, transparent 55%),
        radial-gradient(1000px 700px at 50% 110%, #fce7f3 0%, transparent 55%),
        linear-gradient(135deg, #f8fbff, #eef2ff, #e0e7ff);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* =========================================================
   TOP BAR
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px clamp(16px, 4vw, 40px);
    background: rgba(255, 255, 255, 0.55);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-sm);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #fff;
    background: var(--grad-brand);
    box-shadow: 0 6px 16px rgba(99, 60, 230, 0.35);
}

.brand-name {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 19px;
    letter-spacing: .3px;
    color: var(--ink);
}
.brand-name span { color: var(--violet); }

/* Language switcher (lives in the top bar) */
.select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px 5px 12px;
    border-radius: 999px;
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.select-label { font-size: 15px; }

#language {
    appearance: none;
    -webkit-appearance: none;
    padding: 7px 34px 7px 10px;
    border: none;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237c3aed' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center,
        #fff;
    cursor: pointer;
    outline: none;
    transition: box-shadow .2s ease;
}
#language:focus { box-shadow: 0 0 0 3px var(--ring); }

/* =========================================================
   HERO
   ========================================================= */

.hero {
    text-align: center;
    padding: 56px 20px 28px;
    max-width: 900px;
    margin: 0 auto;
    animation: fadeUp .8s ease both;
}

.hero-badge {
    display: inline-block;
    padding: 8px 18px;
    margin-bottom: 22px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--indigo);
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.hero h1 {
    font-family: 'Sora', 'Poppins', sans-serif;
    font-size: clamp(44px, 8vw, 76px);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -1.5px;

    background: var(--grad-title);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;

    animation: titleMove 9s linear infinite;
}

.hero-tagline {
    margin: 18px auto 0;
    max-width: 620px;
    font-size: clamp(15px, 2.4vw, 18px);
    font-weight: 400;
    line-height: 1.65;
    color: var(--ink-soft);
}

@keyframes titleMove {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* =========================================================
   CONTAINER
   ========================================================= */

.container {
    width: min(92%, 1180px);
    margin: 0 auto;
    padding-bottom: 60px;
}

/* =========================================================
   SEARCH
   ========================================================= */

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;

    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    padding: 10px 10px 10px 18px;
    border-radius: 999px;
    margin-top: 10px;

    transition: box-shadow .3s ease, transform .3s ease;
}

.search-box:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--ring);
}

.search-icon {
    font-size: 18px;
    opacity: .6;
    flex: 0 0 auto;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 14px 6px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--ink);
}

.search-box input::placeholder { color: var(--muted); }

/* =========================================================
   BUTTONS — Primary
   ========================================================= */

.primary-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 14px 26px;
    border: none;
    border-radius: 999px;
    cursor: pointer;

    font-size: 16px;
    font-weight: 600;
    color: #fff;

    background: var(--grad-brand);
    background-size: 180% 180%;
    box-shadow: 0 10px 24px rgba(99, 60, 230, 0.38);
    transition: transform .25s ease, box-shadow .25s ease, background-position .5s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    background-position: 100% 50%;
    box-shadow: 0 16px 32px rgba(99, 60, 230, 0.48);
}

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

.primary-btn span:last-child {
    transition: transform .25s ease;
}
.primary-btn:hover span:last-child { transform: translateX(4px); }

/* =========================================================
   TOOLBAR
   ========================================================= */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 22px;
}

.toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 11px 18px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    cursor: pointer;

    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);

    background: var(--glass-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    transition: transform .22s ease, box-shadow .22s ease, color .22s ease, background .22s ease;
}

.toolbar button:hover {
    transform: translateY(-3px);
    color: var(--violet);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.toolbar button:active { transform: translateY(-1px) scale(.97); }

/* =========================================================
   SECTIONS
   ========================================================= */

.section { margin-top: 48px; }

.section-head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 26px;
}

.section-head h2 {
    font-family: 'Sora', 'Poppins', sans-serif;
    font-size: clamp(22px, 3.4vw, 30px);
    font-weight: 700;
    letter-spacing: -.5px;
    color: var(--ink);
}

.section-head p {
    margin-top: 8px;
    font-size: 15px;
    color: var(--muted);
}

/* =========================================================
   FEATURE CARDS
   ========================================================= */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.card {
    position: relative;
    overflow: hidden;
    padding: 28px 24px;
    border-radius: var(--radius);

    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, border-color .35s ease;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, rgba(124, 58, 237, .45), rgba(236, 72, 153, .25), transparent 60%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.card:hover::before { opacity: 1; }

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 16px;
    font-size: 26px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(79, 70, 229, .14), rgba(236, 72, 153, .14));
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .18);
    transition: transform .35s ease;
}

.card:hover .card-icon { transform: scale(1.08) rotate(-4deg); }

.card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
}

.card p {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--muted);
}

/* =========================================================
   CONTENT PANELS (answer / image / 3D / animation / download)
   ========================================================= */

#answer,
.imageBox,
.modelBox,
.animationBox,
.downloadSection {
    margin-top: 28px;
    padding: 28px;
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: fadeUp .6s ease both;
}

#answer h2,
.imageBox h2,
.modelBox h2,
.animationBox h2,
.downloadSection h2 {
    font-family: 'Sora', 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 16px;
}

#response {
    line-height: 1.8;
    font-size: 16px;
    color: var(--ink-soft);
}

/* Preserve line breaks only for live plain-text AI answers */
#response.plain { white-space: pre-wrap; }

#response ul { margin: 10px 0 0 20px; }
#response li { margin-bottom: 8px; }
#response strong { color: var(--violet); }

#generatedImage {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    margin-top: 10px;
}

/* Two-up media layout (3D + Animation) */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
}
.media-grid > div { margin-top: 0; }

/* Empty / coming-soon placeholders */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 220px;
    padding: 30px;
    text-align: center;
    border-radius: var(--radius-sm);
    border: 1.5px dashed rgba(124, 58, 237, .28);
    background: rgba(255, 255, 255, .35);
    color: var(--muted);
}

.placeholder p { font-size: 15px; font-weight: 500; }
.placeholder-icon { font-size: 40px; opacity: .9; }

.soon-badge {
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #fff;
    border-radius: 999px;
    background: var(--grad-brand);
    box-shadow: 0 6px 14px rgba(99, 60, 230, .3);
}

/* =========================================================
   DOWNLOAD BUTTONS
   ========================================================= */

.downloadSection { text-align: center; }

.download-sub {
    margin: -6px 0 18px;
    font-size: 14.5px;
    color: var(--muted);
}

.download-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.downloadSection button {
    margin: 0;
    padding: 12px 22px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    cursor: pointer;
    color: var(--ink-soft);
    font-size: 15px;
    font-weight: 600;
    background: var(--glass-strong);
    box-shadow: var(--shadow-sm);
    transition: transform .22s ease, box-shadow .22s ease, color .22s ease, background .22s ease;
}

.downloadSection button:hover {
    transform: translateY(-3px);
    color: var(--indigo);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.downloadSection button:active { transform: scale(.96); }

/* =========================================================
   NOTES + HISTORY
   ========================================================= */

.notes-area {
    width: 100%;
    min-height: 150px;
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    resize: vertical;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--glass-strong);
    backdrop-filter: blur(12px);
    outline: none;
    box-shadow: var(--shadow-sm);
}
.notes-area:focus { box-shadow: var(--shadow-md), 0 0 0 3px var(--ring); }

.historyBox {
    margin-top: 22px;
    padding: 26px;
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
}

.historyBox h2 {
    font-family: 'Sora', 'Poppins', sans-serif;
    margin-bottom: 14px;
    color: var(--ink);
}

.history-item {
    padding: 12px 0;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.6;
}

.history-item hr {
    margin-top: 12px;
    border: none;
    border-top: 1px solid rgba(15, 23, 42, .08);
}

/* =========================================================
   LOADING + ERROR STATES
   ========================================================= */

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 28px 24px;
    color: var(--ink-soft);
    font-weight: 500;
}

/* Gradient dual-ring spinner */
.loader {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--indigo), var(--violet), var(--pink), var(--indigo));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
    animation: spin .9s linear infinite;
}

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

/* Animated typing dots */
.loading-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--ink-soft);
}
.dots { display: inline-flex; gap: 5px; }
.dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--violet);
    animation: bounce 1.3s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: .18s; background: var(--pink); }
.dots span:nth-child(3) { animation-delay: .36s; background: var(--indigo); }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(.5); opacity: .4; }
    40%           { transform: scale(1);  opacity: 1; }
}

/* Skeleton shimmer lines (used while the answer streams in) */
.skeleton {
    display: block;
    height: 14px;
    margin: 12px 0;
    border-radius: 7px;
    background: linear-gradient(100deg, rgba(124,58,237,.08) 30%, rgba(124,58,237,.20) 50%, rgba(124,58,237,.08) 70%);
    background-size: 220% 100%;
    animation: shimmer 1.3s linear infinite;
}
.skeleton.w-90 { width: 90%; }
.skeleton.w-75 { width: 75%; }
.skeleton.w-60 { width: 60%; }

@keyframes shimmer {
    0%   { background-position: 180% 0; }
    100% { background-position: -40% 0; }
}

.error-box {
    background: #fef2f2;
    color: #b91c1c;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 14px;
    font-weight: 600;
    border: 1px solid #fecaca;
}

/* =========================================================
   FOOTER
   ========================================================= */

footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

/* =========================================================
   ANIMATED AURORA BACKGROUND
   ========================================================= */

.background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.background span {
    position: absolute;
    display: block;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(50px);
    opacity: .5;
    bottom: -220px;
    animation: float 22s linear infinite;
}

.background span:nth-child(1) { left: 4%;  background: rgba(99, 102, 241, .45); animation-duration: 24s; }
.background span:nth-child(2) { left: 26%; background: rgba(236, 72, 153, .35); width: 380px; height: 380px; animation-duration: 30s; }
.background span:nth-child(3) { left: 50%; background: rgba(14, 165, 233, .35);  animation-duration: 26s; }
.background span:nth-child(4) { left: 70%; background: rgba(124, 58, 237, .40); width: 340px; height: 340px; animation-duration: 32s; }
.background span:nth-child(5) { left: 90%; background: rgba(129, 140, 248, .40); animation-duration: 20s; }

@keyframes float {
    0%   { transform: translateY(0) rotate(0deg);   opacity: 0; }
    10%  { opacity: .5; }
    90%  { opacity: .5; }
    100% { transform: translateY(-120vh) rotate(180deg); opacity: 0; }
}

/* Soft cursor glow */
body::before {
    content: "";
    position: fixed;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(124, 58, 237, .10), transparent 70%);
    pointer-events: none;
    left: var(--x, -300px);
    top: var(--y, -300px);
    transform: translate(-50%, -50%);
    z-index: -1;
}

/* =========================================================
   SHARED ANIMATION
   ========================================================= */

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

input, textarea { cursor: text; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    .hero { padding: 54px 18px 20px; }

    .search-box {
        flex-wrap: wrap;
        border-radius: var(--radius);
        padding: 14px;
    }
    .search-icon { display: none; }
    .search-box input {
        flex: 1 1 100%;
        padding: 12px 14px;
        background: #fff;
        border-radius: var(--radius-sm);
    }
    .primary-btn { flex: 1 1 100%; justify-content: center; }

    #answer, .imageBox, .modelBox, .animationBox, .downloadSection {
        padding: 20px;
    }

    model-viewer { height: 320px; }
}

@media (max-width: 480px) {
    .toolbar button span { display: none; }
    .toolbar button { padding: 11px 14px; font-size: 16px; }
    .brand-name { font-size: 16px; }
    .brand-mark { width: 32px; height: 32px; font-size: 17px; }
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
