/* ==========================================================================
   MainLayout.razor - welcome and CLI download modals
   Moved out of the global pages.css (docs/design-ui-consolidation.md): linked from the component, so it
   applies only while the component is rendered. Dark-mode overrides for these classes stay in
   dark-mode.css; every one of them is theme-prefixed, so it still outranks these rules.
   ========================================================================== */

/* ---- Welcome Modal -------------------------------------------------------- */
.welcome-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1055;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: welcome-fade-in 0.2s ease;
}

@keyframes welcome-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.welcome-modal {
    background: var(--kano-bg-main);
    border: 1px solid var(--kano-line);
    border-radius: 16px;
    width: 520px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    animation: welcome-slide-up 0.25s ease;
    overflow: hidden;
}

@keyframes welcome-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.welcome-modal-header {
    background: linear-gradient(135deg, var(--kano-glow-strong), var(--kano-glow));
    color: #fff;
    padding: 28px 28px 20px;
    text-align: center;
}

.welcome-modal-logo {
    font-size: 2.5rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}

.welcome-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #fff;
}

.welcome-modal-subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
    margin: 0 0 16px;
}

.welcome-step-indicators {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.step-dot.active {
    background: #fff;
    transform: scale(1.3);
}

.welcome-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.welcome-step {
    animation: welcome-step-in 0.2s ease;
}

@keyframes welcome-step-in {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

.welcome-step-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--kano-glow-strong);
}

.welcome-step-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--kano-text-main);
    margin-bottom: 6px;
}

.welcome-step-description {
    color: var(--kano-text-soft);
    font-size: 0.9rem;
    margin-bottom: 14px;
    line-height: 1.5;
}

.welcome-feature-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.welcome-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--kano-bg-soft);
    border: 1px solid var(--kano-line);
}

.welcome-feature-icon {
    font-size: 1.1rem;
    color: var(--kano-glow-strong);
    flex-shrink: 0;
    margin-top: 1px;
}

.welcome-feature-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--kano-text-main);
    line-height: 1.2;
}

.welcome-feature-desc {
    font-size: 0.78rem;
    color: var(--kano-text-soft);
    line-height: 1.3;
}

.welcome-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px 18px;
    border-top: 1px solid var(--kano-line);
    gap: 12px;
}

.welcome-dont-show {
    display: flex;
    align-items: center;
    font-size: 0.82rem;
    color: var(--kano-text-soft);
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.welcome-nav-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

[data-bs-theme="dark"] .welcome-modal-header {
    background: linear-gradient(135deg, #0a3d2e, #0b2e3d);
}

[data-bs-theme="dark"] .welcome-modal-title,
[data-bs-theme="dark"] .welcome-modal-subtitle,
[data-bs-theme="dark"] .welcome-modal-header .step-dot {
    color: #e5e7eb;
}

.welcome-name-field {
    margin-bottom: 16px;
}

.welcome-name-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--kano-text-main);
    margin-bottom: 6px;
}

/* ---- CLI Download Modal --------------------------------------------------- */
.cli-download-modal {
    width: 860px;
}

/* The platform tabs carry the structure now, so the header only needs to introduce
   the modal rather than fill the top third of it. */
.cli-modal-header {
    padding: 20px 28px 16px;
}

.cli-modal-header .welcome-modal-logo {
    font-size: 1.9rem;
    margin-bottom: 4px;
}

.cli-modal-header .welcome-modal-subtitle {
    margin-bottom: 0;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.cli-modal-body {
    padding: 22px 28px;
    overflow-y: auto;
    flex: 1;
}

/* Top-level platform switch: sits outside the scroll area so it stays put. */
.cli-platform-tabs {
    display: flex;
    gap: 2px;
    padding: 0 28px;
    background: var(--kano-bg-soft);
    border-bottom: 1px solid var(--kano-line);
    flex-shrink: 0;
}

.cli-platform-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--kano-text-soft);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cli-platform-tab:hover {
    color: var(--kano-text-main);
    background: var(--kano-bg-main);
}

.cli-platform-tab.active {
    color: var(--kano-glow-strong);
    border-bottom-color: var(--kano-glow-strong);
    background: var(--kano-bg-main);
}

/* Sub-tabs (Launcher / Manual download, Docker run modes) */
.cli-subtabs {
    margin-bottom: 16px;
}

.cli-badge {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 999px;
    background: var(--kano-bg-soft);
    border: 1px solid var(--kano-line);
    color: var(--kano-text-soft);
}

.cli-tab.active .cli-badge {
    border-color: var(--kano-glow-strong);
    color: var(--kano-glow-strong);
}

/* The primary "get it" action for each platform, given room to breathe. */
.cli-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 20px;
    margin-bottom: 16px;
    background: var(--kano-bg-soft);
    border: 1px solid var(--kano-line);
    border-radius: 10px;
}

.cli-hero > .btn,
.cli-hero-buttons {
    flex-shrink: 0;
}

.cli-hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cli-hero-code {
    flex: 0 1 420px;
    margin-bottom: 0;
    background: var(--kano-bg-main);
}

.cli-hero-desc {
    flex: 1;
    margin: 0;
    font-size: 0.875rem;
    color: var(--kano-text-soft);
    line-height: 1.5;
}

.cli-facts {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.cli-facts li {
    position: relative;
    padding-left: 20px;
    font-size: 0.83rem;
    color: var(--kano-text-soft);
    line-height: 1.45;
}

.cli-facts li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.85rem;
    color: var(--kano-glow-strong);
}

.cli-note {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--kano-bg-soft);
    border: 1px solid var(--kano-line);
    font-size: 0.82rem;
    color: var(--kano-text-soft);
    line-height: 1.45;
}

.cli-link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--kano-glow-strong);
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
}

/* Token stays on every platform tab, below the download it belongs to. */
.cli-token-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--kano-line);
}

@media (max-width: 720px) {
    .cli-platform-tabs {
        padding: 0 12px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .cli-platform-tab {
        padding: 10px 12px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .cli-modal-body {
        padding: 18px 16px;
    }

    /* Tab strips scroll rather than pushing the modal sideways. */
    .cli-tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .cli-tab {
        padding: 6px 10px;
    }

    .cli-badge {
        display: none;
    }

    .cli-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .cli-hero-code {
        flex: 1 1 auto;
    }

    /* A 220px name column leaves no room for the description at this width. */
    .cli-env-row {
        flex-direction: column;
        gap: 2px;
    }

    .cli-env-name {
        width: auto;
    }
}

.cli-section {
    margin-bottom: 4px;
}

.cli-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--kano-text-main);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

.cli-section-desc {
    font-size: 0.875rem;
    color: var(--kano-text-soft);
    line-height: 1.5;
    margin-bottom: 12px;
}

.cli-download-btn {
    display: inline-flex;
    align-items: center;
}

.cli-hint {
    font-size: 0.8rem;
    color: var(--kano-text-soft);
}

.cli-divider {
    border-top: 1px solid var(--kano-line);
    margin: 20px 0;
}

.cli-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--kano-line);
    padding-bottom: 0;
}

.cli-tab {
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 0.85rem;
    color: var(--kano-text-soft);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.cli-tab:hover {
    color: var(--kano-text-main);
}

.cli-tab.active {
    color: var(--kano-glow-strong);
    border-bottom-color: var(--kano-glow-strong);
    font-weight: 600;
}

.cli-tab-content {
    animation: welcome-step-in 0.15s ease;
}

.cli-code-block {
    position: relative;
    background: var(--kano-bg-soft);
    border: 1px solid var(--kano-line);
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}

.cli-code-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kano-text-soft);
    padding: 6px 12px 4px;
    border-bottom: 1px solid var(--kano-line);
}

.cli-pre {
    margin: 0;
    padding: 12px 44px 12px 14px;
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    color: var(--kano-text-main);
    background: transparent;
}

.cli-copy-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: var(--kano-text-soft);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: color 0.15s, background 0.15s;
}

.cli-copy-btn:hover {
    color: var(--kano-text-main);
    background: var(--kano-line);
}

.cli-env-table {
    border: 1px solid var(--kano-line);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.82rem;
    margin-top: 16px;
}

.cli-env-header {
    background: var(--kano-bg-soft);
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kano-text-soft);
    border-bottom: 1px solid var(--kano-line);
}

.cli-env-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--kano-line);
}

.cli-env-row:last-child {
    border-bottom: none;
}

.cli-env-name {
    flex-shrink: 0;
    width: 220px;
    font-size: 0.78rem;
    color: var(--kano-glow-strong);
}

.cli-env-desc {
    color: var(--kano-text-soft);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.cli-token-display {
    background: var(--kano-bg-soft);
    border: 1px solid var(--kano-line);
    border-radius: 8px;
    padding: 12px 14px;
}

.cli-token-label {
    font-size: 0.8rem;
    color: var(--kano-text-soft);
    margin-bottom: 8px;
}

.cli-token-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cli-token-value {
    font-size: 0.82rem;
    word-break: break-all;
    color: var(--kano-glow-strong);
    flex: 1;
}

.cli-copy-inline {
    position: static;
    flex-shrink: 0;
}
