/* =========================================================
   UaiFlow OS — Shared Portal Shell v2.0
   Header + Footer + Brand Font + Design System congruente
   ========================================================= */

@font-face {
    font-family: 'Avant Garde';
    src: url('fonts/AvantGardeDemi.otf') format('opentype'),
         url('fonts/AvantGardeDemi.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --sh-bg:         #080c14;
    --sh-card:       rgba(15, 23, 42, 0.68);
    --sh-card-solid: #0f172a;
    --sh-border:     rgba(255, 255, 255, 0.10);
    --sh-text:       #f8fafc;
    --sh-sub:        #94a3b8;
    --sh-muted:      #64748b;
    --sh-accent:     #ea580c;
    --sh-accent-hover: #c2410c;
    --sh-bar-bg:     rgba(8, 12, 20, 0.90);
    --font-brand:    'Avant Garde', 'Inter', system-ui, -apple-system, sans-serif;
    --font-body:     system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html.light-theme {
    --sh-bg:         #f1f5f9;
    --sh-card:       rgba(255, 255, 255, 0.95);
    --sh-card-solid: #ffffff;
    --sh-border:     #cbd5e1;
    --sh-text:       #0f172a;
    --sh-sub:        #334155;
    --sh-muted:      #64748b;
    --sh-bar-bg:     rgba(255, 255, 255, 0.95);
}

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

/* Prevenção Global de Artefatos de Canto Pontiagudo */
.glass-panel, .glass-pill, .uai-card, .uai-chip, .uai-icon-btn, .uai-modal-card, article, .rounded-3xl, .rounded-2xl, .rounded-xl {
    overflow: hidden;
}

.uai-body {
    background:
        radial-gradient(circle at 15% -8%, rgba(59,130,246,.16), transparent 30rem),
        radial-gradient(circle at 85% 0%, rgba(255,90,31,.10), transparent 28rem),
        var(--sh-bg) !important;
    color: var(--sh-text) !important;
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

html.light-theme .uai-body {
    background:
        radial-gradient(circle at 15% -8%, rgba(59,130,246,.06), transparent 30rem),
        radial-gradient(circle at 85% 0%, rgba(255,90,31,.03), transparent 28rem),
        #f1f5f9 !important;
    color: #0f172a !important;
}

/* Header Fixo / Sticky com Scroll-Margin para Evitar Cortes */
.uai-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--sh-bar-bg);
    border-bottom: 1px solid var(--sh-border);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
html.light-theme .uai-header { box-shadow: 0 2px 14px rgba(15,23,42,.08); }

.uai-header-inner {
    max-width: 900px; margin: 0 auto; padding: 0 20px;
    height: 68px; display: flex; align-items: center;
    justify-content: space-between; gap: 16px;
}

.uai-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }

.uai-logo {
    width: 42px; height: 42px; object-fit: contain; flex-shrink: 0;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,.20));
}

.uai-brand-text { min-width: 0; }

.uai-brand-name {
    font-family: var(--font-brand);
    font-size: 15px; font-weight: 950; line-height: 1;
    letter-spacing: -0.01em; text-transform: uppercase;
    white-space: nowrap; color: var(--sh-text); margin: 0; padding: 0;
    display: block;
}

.uai-brand-sub {
    font-size: 8px; font-weight: 900; letter-spacing: .18em;
    text-transform: uppercase; color: var(--sh-accent);
    margin-top: 4px; white-space: nowrap; display: block;
}

.uai-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.uai-chip {
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em;
    color: var(--sh-sub); padding: 5px 10px;
    background: var(--sh-card); border: 1px solid var(--sh-border); border-radius: 8px;
}

.uai-icon-btn {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--sh-card); border: 1px solid var(--sh-border);
    color: var(--sh-sub); cursor: pointer; font-size: 13px;
    transition: color .15s, background .15s, border-color .15s;
    overflow: hidden;
}
.uai-icon-btn:hover { color: var(--sh-accent); border-color: rgba(234,88,12,.35); background: rgba(234,88,12,.08); }
.uai-icon-btn.danger:hover { color: #f87171; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); }

/* Rodapé Padrão Uai Technology */
.uai-standard-footer {
    padding: 2rem 1rem;
    text-align: center;
    margin-top: auto;
    user-select: none;
    border-top: 1px solid var(--sh-border);
}
.uai-standard-footer p {
    font-size: 11px;
    color: var(--sh-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}
.uai-standard-footer a {
    color: var(--sh-accent);
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s;
}
.uai-standard-footer a:hover { opacity: 1; text-decoration: underline; }

.uai-wrap { max-width: 900px; margin: 0 auto; width: 100%; padding: 0 16px; }
.uai-main { flex-grow: 1; padding: 20px 0; scroll-margin-top: 80px; }

.uai-title  { color: var(--sh-text) !important; }
.uai-subtle { color: var(--sh-sub)  !important; }

/* REGRAS CRÍTICAS: PREVENÇÃO DE SOBREPOSIÇÃO DE ÍCONES E TEXTO EM INPUTS */
.uai-input-group, .relative {
    position: relative;
    width: 100%;
}

.uai-input-group i,
.relative i.fas,
.relative i.fab,
.relative i.far {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
}

.uai-input, .tp-input {
    background: var(--sh-card) !important;
    border: 1.5px solid var(--sh-border) !important;
    color: var(--sh-text) !important;
    border-radius: 12px;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

/* Quando o input tem ícone (pl-10 ou pl-11 ou pl-12), garante recuo à esquerda inegociável */
.uai-input.pl-10, .tp-input.pl-10,
.uai-input.pl-11, .tp-input.pl-11,
.uai-input.pl-12, .tp-input.pl-12,
.input-with-icon {
    padding-left: 2.85rem !important;
}

.uai-input::placeholder, .tp-input::placeholder {
    color: var(--sh-muted) !important;
    opacity: 0.85;
}

.uai-input:focus, .tp-input:focus {
    border-color: var(--sh-accent) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.22) !important;
}

/* Anti-corte de cards sob o Header Sticky ao alternar abas/scroll */
[id^="mode-"], section, .glass-panel {
    scroll-margin-top: 90px;
}
