/* =========================================================
   Painel Administrativo — CSS puro (sem frameworks)
   ========================================================= */

:root {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #0ea5e9;
    --success: #16a34a;
    --error: #dc2626;
    --info: #2563eb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.18);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--surface-2);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Login ---------------- */

.auth-body {
    min-height: 100vh;
    margin: 0;
    position: relative;
    overflow: hidden;
    background: radial-gradient(1200px 600px at 50% -10%, #312e81 0%, var(--bg) 55%);
}

/* Imagem de fundo configurável — via <img> (não style inline) p/ respeitar a CSP */
.auth-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}
.auth-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: linear-gradient(115deg,
        rgba(15, 23, 42, 0.88) 0%,
        rgba(15, 23, 42, 0.60) 45%,
        rgba(15, 23, 42, 0.35) 100%);
}

/* Split: frases à esquerda, caixa de login à direita — agrupadas ao centro */
.auth-split {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;          /* centraliza o grupo na tela */
    gap: clamp(32px, 5vw, 80px);
    max-width: 1140px;
    margin: 0 auto;
    padding: 40px;
}

.auth-aside {
    flex: 0 1 460px;                   /* não estica até a borda */
    color: #fff;
}
.auth-aside-inner { max-width: 460px; }
.auth-aside-title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
    margin: 0 0 8px;
    text-shadow: 0 2px 12px rgba(15, 23, 42, 0.45);
}
.auth-aside-tagline {
    font-size: 1.25rem;
    font-style: italic;
    color: #c7d2fe;
    margin: 0 0 28px;
    text-shadow: 0 1px 8px rgba(15, 23, 42, 0.4);
}
.auth-phrases {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.auth-phrases li {
    font-size: 1.08rem;
    color: #f1f5f9;
    opacity: .96;
    text-shadow: 0 1px 8px rgba(15, 23, 42, 0.45);
}

.auth-main {
    flex: 0 0 400px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-main-inner { width: 100%; max-width: 400px; }

@media (max-width: 860px) {
    .auth-split {
        flex-direction: column;
        gap: 24px;
        padding: 32px 20px;
    }
    .auth-aside {
        flex: none;
        text-align: center;
    }
    .auth-aside-inner { margin: 0 auto; }
    .auth-phrases { align-items: center; }
    .auth-main { flex: none; width: 100%; }
}

.login-card {
background: #ffffff30;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.35);
    padding: 44px 36px;
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo img {
    max-height: 80px;
    max-width: 100%;
    object-fit: contain;
}

.login-title {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary);
}

.login-tagline {
    text-align: center;
    margin: -8px 0 20px;
    color: var(--text-muted);
    font-size: .98rem;
    font-style: italic;
}

.login-heading {
    text-align: center;
    margin: 0 0 24px;
    font-size: 1.25rem;
    font-weight: 600;
}

/* ---------------- Topbar / menu ---------------- */

.topbar {
    background: var(--bg);
    color: #e2e8f0;
    box-shadow: var(--shadow);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}
.brand:hover { text-decoration: none; }
.brand-logo { max-height: 40px; max-width: 180px; object-fit: contain; }
.brand-text { font-weight: 700; font-size: 1.1rem; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav > a,
.dropdown-toggle,
.link-button {
    color: #cbd5e1;
    background: transparent;
    border: 0;
    font: inherit;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.main-nav > a:hover,
.dropdown-toggle:hover,
.link-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
}

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    min-width: 180px;
    padding: 6px;
    display: none;
    z-index: 20;
}
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text);
}
.dropdown-menu a:hover { background: var(--surface-2); text-decoration: none; }

.logout-form { margin: 0; }

/* ---------------- Conteúdo ---------------- */

.content { padding: 32px 0 64px; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.page-header h1 { margin: 0 0 20px; font-size: 1.6rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 1.2rem; }
.card h3 { margin: 0 0 8px; }

.welcome h2 { margin-top: 0; }
.muted { color: var(--text-muted); }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.card-link { display: block; color: var(--text); }
.card-link:hover { text-decoration: none; transform: translateY(-2px); transition: transform .15s; box-shadow: var(--shadow-lg); }

/* ---------------- Formulários ---------------- */

.form { display: block; }
.field { margin-bottom: 16px; display: flex; flex-direction: column; }
.field label { font-weight: 600; margin-bottom: 6px; font-size: .9rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; min-height: 92px; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.hint { color: var(--text-muted); font-size: .8rem; margin-top: 4px; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.password-wrap { position: relative; display: flex; }
.password-wrap input { padding-right: 44px; }
.toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    line-height: 1;
}

.form-actions { margin-top: 8px; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .grow { flex: 1; min-width: 220px; }

.preview {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    background: var(--surface-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.preview-logo img { max-height: 56px; max-width: 220px; object-fit: contain; }
.preview-favicon img { width: 32px; height: 32px; object-fit: contain; }
.preview-bg { display: block; padding: 8px; }
.preview-bg img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 6px; }

/* ---------------- Botões ---------------- */

.btn {
    display: inline-block;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 11px 20px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { opacity: .9; }
.btn-block { width: 100%; }

/* ---------------- Tabs ---------------- */

.tab-list {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- Flash ---------------- */

.flash-stack { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    background: #fff;
    box-shadow: var(--shadow);
}
.flash-success { border-color: var(--success); color: #14532d; background: #f0fdf4; }
.flash-error { border-color: var(--error); color: #7f1d1d; background: #fef2f2; }
.flash-info { border-color: var(--info); color: #1e3a8a; background: #eff6ff; }
.flash-close { background: transparent; border: 0; font-size: 1.3rem; cursor: pointer; color: inherit; opacity: .6; line-height: 1; }
.flash-close:hover { opacity: 1; }

/* ---------------- Tabela / lista ---------------- */

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-narrow { max-width: 560px; }

.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
}
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table thead th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
}
.table tbody tr:hover { background: var(--surface-2); }
.ta-right { text-align: right; }

.row-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.row-actions form { margin: 0; }

/* Botões menores e variantes */
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }

/* Badges de status */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }

/* ---------------- Eliot / Roteiro ---------------- */

.btn:disabled { opacity: .5; cursor: not-allowed; }

.roteiro-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .roteiro-layout { grid-template-columns: 1fr; }
}

.roteiro-result { max-height: none; }
.markdown { line-height: 1.7; color: var(--text); }
.markdown h2 { font-size: 1.3rem; margin: 18px 0 8px; }
.markdown h3 { font-size: 1.12rem; margin: 16px 0 6px; color: var(--primary); }
.markdown h4 { font-size: 1rem; margin: 14px 0 4px; }
.markdown p { margin: 0 0 12px; }
.markdown ul, .markdown ol { margin: 0 0 12px; padding-left: 22px; }
.markdown li { margin-bottom: 4px; }
.markdown strong { color: var(--text); }

.roteiro-right { min-width: 0; }

/* Caixa "pensando" durante a geração do roteiro */
.roteiro-loading {
    text-align: center;
    padding: 40px 28px;
    border: 1px dashed var(--border);
}
.roteiro-loading h2 { margin: 14px 0 8px; }
.roteiro-loading p { margin: 0; }

.loader-hourglass {
    font-size: 3rem;
    line-height: 1;
    display: inline-block;
    transform-origin: 50% 50%;
    animation: hourglass-flip 1.6s ease-in-out infinite;
}
@keyframes hourglass-flip {
    0%   { transform: rotate(0deg); }
    50%  { transform: rotate(180deg); }
    50.01%, 100% { transform: rotate(360deg); }
}

/* Barra de progresso indeterminada */
.loader-bar {
    margin: 22px auto 0;
    width: 100%;
    max-width: 320px;
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.loader-bar span {
    position: absolute;
    left: -40%;
    top: 0;
    height: 100%;
    width: 40%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    animation: loader-slide 1.2s ease-in-out infinite;
}
@keyframes loader-slide {
    0%   { left: -40%; }
    100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .loader-hourglass { animation-duration: 3.2s; }
    .loader-bar span { animation-duration: 2.4s; }
}

/* Exportar com Gamma */
.gamma-export {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.gamma-status {
    margin-top: 16px;
    text-align: center;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 20px;
}
.gamma-status .loader-hourglass { font-size: 2.2rem; }
.gamma-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}
.gamma-ok { color: var(--success); font-weight: 600; }
.gamma-error { color: var(--error); font-weight: 600; margin: 0; }

/* ---------------- Rodapé ---------------- */

.site-footer {
    text-align: center;
    font-size: .78rem;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 24px 16px;
}
.site-footer p { margin: 0; }

/* Rodapé sobre a tela de login (fundo escuro/imagem) */
.auth-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(15, 23, 42, 0.55);
    padding: 16px;
    pointer-events: none;
}
