/* Estilos compartilhados pelas páginas públicas (login universal e portal do cliente).
   Usa as variaveis emitidas por theme_emit_css(). */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
    --pub-bg: #f5f7fb;
    --pub-card-bg: #ffffff;
    --pub-text: #0f172a;
    --pub-text-muted: #64748b;
    --pub-border: #e2e8f0;
    --pub-border-strong: #cbd5e1;
    --pub-shadow-sm: 0 1px 3px rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.06);
    --pub-shadow-md: 0 10px 25px -5px rgba(15,23,42,0.10), 0 8px 10px -6px rgba(15,23,42,0.05);
    --pub-shadow-lg: 0 24px 60px -12px rgba(15,23,42,0.25);
    --pub-radius: 14px;
    --pub-radius-sm: 10px;
    --pub-success: #16a34a;
    --pub-warning: #d97706;
    --pub-danger: #dc2626;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--pub-text);
    background: var(--pub-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ----- Auth (login universal) -------------------------------------------- */

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    background: var(--pub-bg);
}

.auth-aside {
    background: linear-gradient(135deg, var(--brand-login-from, #0a74d7) 0%, var(--brand-login-to, #7c3aed) 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-aside::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(at 20% 80%, rgba(255,255,255,0.18) 0, transparent 40%),
        radial-gradient(at 80% 20%, rgba(255,255,255,0.12) 0, transparent 35%);
    pointer-events: none;
}
.auth-aside-inner { position: relative; z-index: 1; max-width: 440px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.auth-brand-mark {
    width: 44px; height: 44px; border-radius: 12px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,0.25);
}
.auth-brand-mark svg { width: 22px; height: 22px; fill: #fff; }
.auth-brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.auth-headline { font-size: clamp(28px, 3.4vw, 40px); font-weight: 700; line-height: 1.15; margin: 0 0 18px; letter-spacing: -0.025em; }
.auth-sub { font-size: 16px; line-height: 1.6; opacity: 0.92; margin: 0; max-width: 380px; }
.auth-features { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 14px; max-width: 380px; }
.auth-features li { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; line-height: 1.5; opacity: 0.95; }
.auth-features svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.auth-aside-footer { font-size: 12px; opacity: 0.7; margin-top: 32px; position: relative; z-index: 1; }

.auth-main {
    padding: 32px 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    width: 100%;
    max-width: 420px;
}
.auth-card h1 { font-size: 24px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-card .auth-subtitle { color: var(--pub-text-muted); font-size: 14px; margin: 0 0 24px; }

.tabs-pill {
    display: flex; gap: 4px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 22px;
}
.tabs-pill .tab {
    flex: 1; text-align: center; padding: 9px 12px;
    font-size: 13px; font-weight: 600;
    color: var(--pub-text-muted); cursor: pointer;
    border-radius: 7px; user-select: none;
    transition: background 0.15s, color 0.15s;
}
.tabs-pill .tab.active { background: #fff; color: var(--pub-text); box-shadow: var(--pub-shadow-sm); }
.tabs-pill .tab:not(.active):hover { color: var(--pub-text); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--pub-text); }
.field input, .field select {
    width: 100%; padding: 11px 13px;
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius-sm);
    font-size: 14px; background: #fff; color: var(--pub-text);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.field input:focus, .field select:focus {
    outline: none; border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 18%, transparent);
}
.field .hint { font-size: 12px; color: var(--pub-text-muted); margin-top: 5px; }

.btn-pub {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px 18px;
    border: none; border-radius: var(--pub-radius-sm);
    background: var(--brand-primary); color: var(--brand-text-on-primary, #fff);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    font-family: inherit;
}
.btn-pub:hover { background: var(--brand-primary-hover); }
.btn-pub:active { transform: translateY(1px); }
.btn-pub.secondary { background: #f1f5f9; color: var(--pub-text); border: 1px solid var(--pub-border); }
.btn-pub.secondary:hover { background: #e2e8f0; }
.btn-pub.danger { background: #fee2e2; color: var(--pub-danger); }
.btn-pub.danger:hover { background: #fecaca; }
.btn-pub.compact { width: auto; padding: 8px 14px; font-size: 13px; }

.remember-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--pub-text-muted); margin: 4px 0 16px; cursor: pointer; }
.remember-row input { width: 16px; height: 16px; accent-color: var(--brand-primary); }

.alert-pub {
    padding: 11px 14px;
    border-radius: var(--pub-radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}
.alert-pub.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-pub.info { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.alert-pub.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.panel { display: none; }
.panel.active { display: block; }

.auth-footnote { text-align: center; font-size: 12px; color: var(--pub-text-muted); margin-top: 22px; }
.auth-footnote a { color: var(--brand-primary); text-decoration: none; font-weight: 600; }
.auth-footnote a:hover { text-decoration: underline; }

/* ----- Portal do cliente ------------------------------------------------- */

.portal-shell { min-height: 100vh; background: var(--pub-bg); }
.portal-header {
    background: #fff;
    border-bottom: 1px solid var(--pub-border);
    padding: 16px 0;
    position: sticky; top: 0; z-index: 10;
}
.portal-container { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.portal-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-brand { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 700; color: var(--pub-text); }
.portal-brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    display: flex; align-items: center; justify-content: center;
}
.portal-brand-mark svg { width: 18px; height: 18px; fill: #fff; }
.portal-user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--pub-text-muted); }
.portal-user a { color: var(--pub-text-muted); text-decoration: none; }
.portal-user a:hover { color: var(--pub-text); }

.portal-body { padding: 28px 0 60px; }

.section-card {
    background: var(--pub-card-bg);
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius);
    box-shadow: var(--pub-shadow-sm);
    margin-bottom: 18px;
    overflow: hidden;
}
.section-head {
    padding: 18px 22px;
    border-bottom: 1px solid var(--pub-border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.section-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.section-head p { margin: 2px 0 0; font-size: 13px; color: var(--pub-text-muted); }
.section-body { padding: 20px 22px; }

.invoice-card {
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius);
    padding: 18px;
    margin-bottom: 14px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.invoice-card:hover { border-color: var(--pub-border-strong); box-shadow: var(--pub-shadow-sm); }
.invoice-card:last-child { margin-bottom: 0; }
.invoice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.invoice-head h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.invoice-meta { font-size: 12px; color: var(--pub-text-muted); }
.invoice-amount { font-size: 18px; font-weight: 700; color: var(--pub-text); white-space: nowrap; }

.pay-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.pay-option {
    border: 1px solid var(--pub-border); border-radius: var(--pub-radius-sm); padding: 14px; background: #fafbfd;
}
.pay-option h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pub-text-muted); }
.pix-qr { display: block; max-width: 180px; margin: 0 0 8px; border-radius: 8px; }
.pix-code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px; word-break: break-all;
    background: #fff; padding: 8px; border: 1px solid var(--pub-border); border-radius: 6px;
    max-height: 96px; overflow: auto; line-height: 1.4;
}
.pay-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.pub-table { width: 100%; border-collapse: collapse; }
.pub-table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--pub-text-muted); border-bottom: 1px solid var(--pub-border); background: #fafbfd; }
.pub-table td { padding: 12px; border-bottom: 1px solid #f1f5f9; font-size: 14px; vertical-align: middle; }
.pub-table tr:last-child td { border-bottom: none; }

.badge-pub { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.badge-pub.active, .badge-pub.paid { background: #dcfce7; color: #166534; }
.badge-pub.paused { background: #fef3c7; color: #92400e; }
.badge-pub.canceled { background: #fee2e2; color: #991b1b; }
.badge-pub.pending { background: #fef3c7; color: #92400e; }
.badge-pub.overdue, .badge-pub.failed { background: #fee2e2; color: #991b1b; }

.empty-pub { text-align: center; color: var(--pub-text-muted); padding: 36px 16px; }
.empty-pub h3 { margin: 0 0 6px; color: var(--pub-text); font-size: 16px; font-weight: 700; }
.empty-pub p { margin: 0; font-size: 14px; }

/* ----- Responsividade ---------------------------------------------------- */

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { padding: 32px 20px; }
}
@media (max-width: 640px) {
    .portal-container { padding: 0 16px; }
    .section-head, .section-body { padding-left: 16px; padding-right: 16px; }
    .invoice-head { flex-direction: column; }
    .pub-table { font-size: 13px; }
    .pub-table th, .pub-table td { padding: 8px; }
    .auth-card { max-width: 100%; }
}
