/* ============================================================
   setup.css — AIDMS Setup UI  (redesign 2026)
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
    --bg-primary: #f0f4ff;
    --bg-secondary: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-primary: #4f46e5;
    --accent-secondary: #7c3aed;
    --ai-accent: #06b6d4;
    --border-color: rgba(148, 163, 184, 0.25);
    --card-bg: #ffffff;
    --input-bg: #f8fafc;
    --hover-bg: #f1f5f9;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --error-text: #dc2626;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --success-text: #16a34a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(79,70,229,.08), 0 1px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 20px 40px rgba(79,70,229,.12), 0 4px 12px rgba(0,0,0,.06);
    --radius: 16px;
    --radius-sm: 10px;
    --shepherd-bg: var(--bg-primary);
    --shepherd-text: var(--text-primary);
    --shepherd-border: var(--border-color);
    --shepherd-button-primary: var(--accent-primary);
    --shepherd-button-text: white;
}

[data-theme="dark"] {
    --bg-primary: #0b0f1e;
    --bg-secondary: #111827;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --card-bg: #161d2f;
    --input-bg: #1e2a3f;
    --hover-bg: #1e293b;
    --border-color: rgba(51,65,85,.5);
    --shadow-md: 0 4px 16px rgba(0,0,0,.3);
    --shadow-lg: 0 20px 40px rgba(0,0,0,.4);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(79,70,229,.12), transparent),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(124,58,237,.08), transparent);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
}

h1,h2,h3,h4,h5,h6 { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }

/* ── Scan line ──────────────────────────────────────────── */
@keyframes scanning {
    0%   { transform: translateY(-100%); opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

.ai-scan-line {
    position: fixed;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--ai-accent) 50%, transparent 100%);
    box-shadow: 0 0 20px var(--ai-accent);
    z-index: 9999;
    pointer-events: none;
    animation: scanning 5s linear infinite;
}

/* ── Navigation ─────────────────────────────────────────── */
.modern-nav {
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(79,70,229,.06);
}

[data-theme="dark"] .modern-nav {
    background: rgba(11,15,30,.8);
}

.nav-brand-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.25;
    margin: 0;
    white-space: normal;
    max-width: min(100%, 720px);
}

.nav-brand-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
}

/* ── Card ───────────────────────────────────────────────── */
.material-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(79,70,229,.08);
    position: relative;
    overflow: hidden;
    transition: box-shadow .3s ease;
}

.material-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, rgba(79,70,229,.18), transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ── Progress bar ───────────────────────────────────────── */
.progress-bar {
    height: 5px;
    background: rgba(79,70,229,.1);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 999px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 0 10px rgba(79,70,229,.4);
}

/* ── Tab Navigation ─────────────────────────────────────── */
.tab-navigation {
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 10;
    padding-top: .5rem;
}

.tab-navigation nav {
    display: flex;
    gap: .5rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1rem;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--text-secondary);
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: all .2s ease;
}

.tab-button:not(.active):hover {
    background: var(--hover-bg);
    color: var(--accent-primary);
    border-color: rgba(79,70,229,.15);
}

.tab-button.active {
    background: linear-gradient(135deg, rgba(79,70,229,.1), rgba(124,58,237,.08));
    color: var(--accent-primary);
    border-color: rgba(79,70,229,.25);
    box-shadow: 0 2px 8px rgba(79,70,229,.12);
}

.tab-button i {
    font-size: .8em;
}

/* ── Tab Content ────────────────────────────────────────── */
.tab-content { display: none; animation: tabFadeIn .25s ease; }
.tab-content.active { display: block; }

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

/* ── Section Title ──────────────────────────────────────── */
.section-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-primary);
    padding-bottom: .75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1.5px solid rgba(79,70,229,.12);
}

.section-title i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(124,58,237,.08));
    border-radius: 8px;
    font-size: .8rem;
    flex-shrink: 0;
}

/* ── Form Elements ──────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.modern-input {
    background: var(--input-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: .7rem 1rem;
    color: var(--text-primary);
    width: 100%;
    font-size: .9rem;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
}

.modern-input:hover {
    border-color: rgba(79,70,229,.3);
    background: var(--bg-secondary);
}

.modern-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12), inset 0 1px 2px rgba(0,0,0,.02);
}

.modern-input::placeholder { color: var(--text-secondary); opacity: .6; }

select.modern-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ── Password input ─────────────────────────────────────── */
.password-input { position: relative; }

.password-toggle {
    position: absolute;
    right: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: .2rem;
    font-size: .85rem;
    transition: color .2s ease;
}

.password-toggle:hover { color: var(--accent-primary); }

/* ── Buttons ────────────────────────────────────────────── */
.material-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.5rem;
    font-size: .9rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    box-shadow: 0 4px 12px rgba(79,70,229,.3);
    letter-spacing: .01em;
}

.material-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79,70,229,.4);
}

.material-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}

.material-button.disabled,
.material-button:disabled {
    background: linear-gradient(135deg, #cbd5e1, #e2e8f0);
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}

.material-button-2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.5rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(79,70,229,.08);
    border: 1.5px solid rgba(79,70,229,.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s ease;
}

.material-button-2:hover {
    background: rgba(79,70,229,.14);
    border-color: rgba(79,70,229,.35);
}

.submit-btn { width: 100%; padding: .9rem; font-size: .95rem; }

#prevBtn, #nextBtn, #submitBtn { min-width: 120px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: .9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .88rem;
}

.alert-error {
    background: var(--error-bg);
    border: 1.5px solid var(--error-border);
    color: var(--error-text);
}

.alert-success {
    background: var(--success-bg);
    border: 1.5px solid var(--success-border);
    color: var(--success-text);
}

/* ── Tags ───────────────────────────────────────────────── */
.tag-input-container { display: flex; gap: .5rem; }

.tags-container { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }

.modern-tag {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    box-shadow: 0 2px 6px rgba(79,70,229,.25);
}

.modern-tag button {
    background: none; border: none; color: rgba(255,255,255,.8);
    padding: 0; cursor: pointer; font-size: .75rem;
    transition: color .2s ease;
}
.modern-tag button:hover { color: white; }

/* ── Help text ──────────────────────────────────────────── */
.help-text {
    font-size: .78rem;
    color: var(--text-secondary);
    margin-top: .25rem;
    line-height: 1.5;
}

/* ── Prompt container ───────────────────────────────────── */
.prompt-container { display: flex; gap: .5rem; }
.prompt-container textarea { flex: 1; min-height: 200px; resize: vertical; }

/* ── Provider settings ──────────────────────────────────── */
.provider-settings { display: none; }

/* ── Checkbox ───────────────────────────────────────────── */
.checkbox-container { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-container input[type="checkbox"] { margin-right: 5px; }

/* ── Disabled states ────────────────────────────────────── */
.modern-input.disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; opacity: .7; pointer-events: none; }
textarea.disabled { resize: none; }

/* ── Theme Toggle ───────────────────────────────────────── */
.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-sm);
    padding: .45rem .65rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all .2s ease;
}
.theme-toggle:hover { color: var(--accent-primary); border-color: rgba(79,70,229,.3); }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(79,70,229,.25); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79,70,229,.45); }

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-in { animation: fadeIn .3s ease; }

/* ── Shepherd tour ──────────────────────────────────────── */
.shepherd-modal-overlay-container { background: rgba(0,0,0,.45); }

.shepherd-element {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg) !important;
}
.shepherd-text { color: var(--text-primary) !important; }
.shepherd-header { background: var(--card-bg) !important; border-bottom: 1px solid var(--border-color) !important; }
.shepherd-title { color: var(--text-primary) !important; font-size: 1.1rem !important; font-weight: 700 !important; }
.shepherd-cancel-icon { color: var(--text-secondary) !important; }
.shepherd-button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    color: white !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
}
.shepherd-button:not(:disabled):hover { opacity: .9 !important; }
.shepherd-button.shepherd-button-secondary {
    background: transparent !important;
    color: var(--text-primary) !important;
    border: 1.5px solid var(--border-color) !important;
}
.shepherd-arrow::before { background: var(--card-bg) !important; border: 1px solid var(--border-color) !important; }

/* ── Tippy tooltips ─────────────────────────────────────── */
.tippy-box[data-theme~='custom'] {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-sm);
}
.tippy-box[data-theme~='custom'] .tippy-content { padding: 0; }
.tippy-box[data-theme~='custom'] .tooltip-content { font-size: .875rem; line-height: 1.4; }
.tippy-box[data-theme~='custom'][data-placement^='right'] > .tippy-arrow::before { border-right-color: var(--border-color); }
.tippy-box[data-theme~='custom'] code { font-family: monospace; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 4px; padding: 0 3px; }

/* ── SweetAlert ─────────────────────────────────────────── */
.my-swal { z-index: 9999; }
.swal2-popup { font-size: .9rem !important; border-radius: var(--radius) !important; }
.swal2-title { font-size: 1.2rem !important; font-weight: 700 !important; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    body { margin: 0; }
    .material-card { padding: 1.25rem; border-radius: var(--radius-sm); }
    .tab-navigation { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-button { white-space: nowrap; }
    .prompt-container { flex-direction: column; }
    .tag-input-container { flex-direction: column; }
    .theme-toggle { top: auto; bottom: 1.25rem; }
    .checkbox-container { flex-direction: column; }
}

@media (max-width: 768px) {
    .tippy-box[data-theme~='custom'] { max-width: 90vw !important; }
}
