html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

:root {
    --blue: #0071CE;
    --blue-dk: #005BA6;
    --blue-lt: #E8F3FC;
    --sky: #4DAEE8;
    --white: #FFFFFF;
    --off-white: #F5F8FC;
    --gray-lt: #EEF2F7;
    --gray-dk: #6B7E94;
    --text: #1A2B3C;
    --text-lt: #4A607A;
    --border: #D4E2EF;
    --navy: #0A1E33;
    --shell-px: clamp(16px, 5vw, 80px);
    --px: clamp(16px, 5vw, 80px);
    --hero-radius: 22px;
}

body {
    margin-bottom: 60px;
}

    body.studio-shell-body {
        margin: 0;
        font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        color: var(--text);
        background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
    }

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Legacy compatibility styles retained for pages not yet migrated */

.assistant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}

.assistant-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 1.4rem;
    border: 1px solid #e5e5e5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

    .assistant-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 12px rgba(0,0,0,0.08);
    }

.assistant-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: .3rem;
}

.assistant-desc {
    flex-grow: 1;
    color: #555;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.assistant-btn {
    margin-top: auto;
    text-decoration: none;
    background: #0069d9;
    color: white;
    padding: .45rem .75rem;
    border-radius: 6px;
    display: inline-block;
    font-size: .9rem;
    transition: background .15s ease;
}

    .assistant-btn:hover {
        background: #005bb5;
    }

.assistant-btn-secondary {
    background: #f1f3f5;
    margin-top: auto;
    text-decoration: none;
    color: #3f51b5;
    padding: .45rem .75rem;
    border-radius: 6px;
    border: 1px solid #d0d4d9;
    display: inline-block;
    font-size: .9rem;
    transition: background .15s ease;
}

.assistant-output {
    white-space: pre-wrap;
    font-family: Consolas, monospace;
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
}

.assistant-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

    .assistant-btn-row .assistant-btn {
        flex: 1;
        text-align: center;
        display: block;
    }

.ai-home {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 40px 3rem;
    background-image: url('/images/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #fafafa;
}

.ai-home-header {
    margin-bottom: 2.5rem;
    text-align: left;
}

.ai-home-header-with-toolbar {
    margin-bottom: .5rem;
    text-align: left;
}

.ai-home-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.ai-home-subtitle {
    color: #555;
    font-size: 0.98rem;
    max-width: 800px;
}

.ai-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.ai-card {
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 4px 12px rgba(0,0,0,0.0);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-width: 300px;
}

.ai-card-header {
    margin-bottom: 0.75rem;
}

.ai-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.ai-card-tag {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #f3f4ff;
    color: #3f51b5;
    margin-bottom: 0.4rem;
}

.ai-card-body {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 1rem;
}

.ai-card-footer {
    margin-top: auto;
}

.ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.ai-btn-primary {
    background: #3f51b5;
    color: #fff;
}

.ai-btn-ghost {
    background: transparent;
    color: #3f51b5;
    border: 1px solid #d0d2ff;
}

.ai-btn span.icon {
    font-size: 1rem;
    line-height: 1;
}

.ai-home-footer-note {
    margin-top: 2rem;
    font-size: 0.78rem;
    color: #888;
}

/* Modal / offcanvas behavior */

.studio-run-modal .modal-dialog {
    height: calc(100vh - 3rem);
}

.studio-run-modal .modal-content {
    height: 100%;
}

.studio-run-modal .modal-body {
    overflow: hidden;
}

    .studio-run-modal .modal-body .col-lg-4,
    .studio-run-modal .modal-body .col-lg-8 {
        max-height: calc(100vh - 12rem);
        overflow-y: auto;
    }

.studio-step-canvas {
    --bs-offcanvas-width: 900px;
}

/* ---------------------------------------------------------------------------
   Busy feedback (driven by wwwroot/js/site.js)

   Studio is server-rendered, so the gap between pressing a button and the next
   page arriving is dead air. These are the two things that fill it: the button
   says what it is doing, and a hairline bar at the top says the browser is
   still working. Blueprint rules apply — square edges, theme tokens, no colour
   that isn't already in the system. The spinner is the one exception to "no
   rounded corners": a square spinner is just a box.
   --------------------------------------------------------------------------- */

.studio-spin {
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 8px;
    vertical-align: -1px;
    border: 1.5px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: .85;
    animation: studio-spin .6s linear infinite;
}

@keyframes studio-spin {
    to { transform: rotate(360deg); }
}

/* Busy submit buttons stay legible: dimmed, not greyed into nothing, and the
   cursor says "not now" rather than "broken". */
button.is-busy,
input.is-busy[type="submit"] {
    opacity: .78;
    cursor: progress;
}

button.is-busy > span {
    vertical-align: middle;
}

/* A form mid-submit shouldn't accept more input. */
form.is-busy {
    cursor: progress;
}

/* Hairline progress bar. Indeterminate on purpose — we genuinely don't know how
   long the server will take, and a fake percentage is a lie. */
.studio-busybar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    background: transparent;
    transition: opacity .2s ease;
}

.studio-busybar.on {
    opacity: 1;
}

.studio-busybar.on::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    background: var(--accent, #0fb5a1);
    box-shadow: 0 0 10px var(--glow1, rgba(15, 181, 161, .5));
    animation: studio-busybar-slide 1.1s ease-in-out infinite;
}

.studio-busybar.done {
    opacity: 0;
}

@keyframes studio-busybar-slide {
    0%   { left: -40%; }
    100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .studio-spin { animation: none; opacity: .5; }
    .studio-busybar.on::before { animation: none; width: 100%; opacity: .45; }
}
