/* =========================================================
   BlogAI Generator - Design System v2
   App shell com sidebar fixa + temas Dark / Clean
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* ---- Tema Dark ---- */
    --bg: #0a0f1a;
    --bg-elevated: #131c2e;
    --sidebar-bg: #0c1322;
    --card: #131c2e;
    --card-hover: #1a2538;
    --card-border: #22304a;
    --text: #f0f4fa;
    --text-dim: #a8b8d0;
    --text-faint: #6b7f99;

    --accent: #0ea5e9;
    --accent-hover: #38bdf8;
    --accent-soft: rgba(14, 165, 233, 0.16);
    --accent-text-on: #fff;

    --mint: #10b981;
    --mint-soft: rgba(16, 185, 129, 0.14);

    --success: #10b981;
    --danger: #ef5a5a;
    --danger-soft: rgba(239, 90, 90, 0.13);
    --warning: #f5b94c;
    --warning-soft: rgba(245, 185, 76, 0.13);

    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.5);
    --shadow-lg: 0 16px 48px -16px rgba(0,0,0,0.6);

    --display: "Space Grotesk", "Inter", sans-serif;
    --body: "Inter", -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", monospace;

    --radius: 14px;
    --radius-sm: 9px;

    --sidebar-width: 240px;
}

/* ---- Tema Clean (claro) ---- */
[data-theme="clean"] {
    --bg: #e9eef4;
    --bg-elevated: #ffffff;
    --sidebar-bg: #0c1322;
    --card: #ffffff;
    --card-hover: #f4f7fb;
    --card-border: #d6dde7;
    --text: #0f172a;
    --text-dim: #5b6b82;
    --text-faint: #94a3b8;

    --accent: #0284c7;
    --accent-hover: #0369a1;
    --accent-soft: rgba(2, 132, 199, 0.10);
    --accent-text-on: #fff;

    --mint: #059669;
    --mint-soft: rgba(5, 150, 105, 0.10);

    --success: #059669;
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.08);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.10);

    --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 6px 20px -10px rgba(15,23,42,0.10);
    --shadow-lg: 0 12px 36px -12px rgba(15,23,42,0.16);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }
[data-theme="clean"] html { color-scheme: light; }

/* Sidebar permanece escura no tema Clean para dar contraste/ancoragem */
[data-theme="clean"] .sidebar {
    --text: #eef2f7;
    --text-dim: #8a9bb5;
    --text-faint: #51617c;
    --card-border: #22304a;
    --card-hover: #1a2538;
}
[data-theme="clean"] .sidebar .brand-mark::after {
    background: var(--sidebar-bg);
}

body {
    font-family: var(--body);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background .25s ease, color .25s ease;
}

a { color: inherit; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 28px;
}
.brand-mark {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--mint));
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 14px -4px var(--accent);
}
.brand-mark::after {
    content: "";
    position: absolute;
    inset: 9px;
    background: var(--sidebar-bg);
    border-radius: 5px;
}
.brand-text {
    font-family: var(--display);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.15;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.brand-text span { color: var(--mint); }
.brand-suffix {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 9.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent) !important;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
    width: fit-content;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-dim);
    font-size: 14.5px;
    font-weight: 500;
    transition: all .15s ease;
}
.sidebar-nav a:hover {
    color: var(--text);
    background: var(--card-hover);
    border-color: var(--accent-soft);
}
.sidebar-nav a.active {
    color: var(--text);
    font-weight: 600;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    position: relative;
}
.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 18px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.nav-icon {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    filter: grayscale(1) opacity(0.75);
}
.sidebar-nav a.active .nav-icon,
.sidebar-nav a:hover .nav-icon {
    filter: none;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
    margin-top: 16px;
}

.sidebar-user {
    padding: 4px 10px 14px;
}
.sidebar-user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-plan {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-logout {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.sidebar-logout:hover { text-decoration: underline; }
.sidebar-sep {
    margin-top: 8px;
    display: inline-block;
    font-size: 13px;
    color: var(--text-faint);
    margin-left: 4px;
    margin-right: 4px;
}

@media (max-width: 980px) {
    .sidebar-user-name, .sidebar-user-plan, .sidebar-logout, .sidebar-sep { display: none; }
}

/* ---------- MAIN AREA ---------- */
.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    padding: 28px 36px 0;
}
.page-title {
    font-family: var(--display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}
.page-subtitle {
    color: var(--text-dim);
    font-size: 14.5px;
    margin: 6px 0 0;
}

.content {
    padding: 22px 36px 60px;
    max-width: 1200px;
}

/* ---------- THEME TOGGLE ---------- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 3px;
}
.theme-toggle button {
    flex: 1;
    margin: 0;
    padding: 7px 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    border: none;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--body);
    cursor: pointer;
    transition: all .15s ease;
}
.theme-toggle button.active {
    background: var(--accent);
    color: #fff;
}
.theme-toggle button:not(.active):hover { color: var(--text); }

/* ---------- MESSAGE ---------- */
.message {
    background: var(--mint-soft);
    border: 1px solid var(--mint);
    color: var(--text);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 14.5px;
}

/* ---------- TABS (legado, ainda usado em alguma página) ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--card-border); }
.tab {
    padding: 11px 20px;
    cursor: pointer;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    font-size: 14.5px;
    font-weight: 500;
    transition: color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .25s ease; }

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

/* ---------- SECTION LABEL (eyebrow) ---------- */
.section-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 6px;
}

/* ---------- STATUS STRIP (signature element) ---------- */
.status-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1px;
    background: var(--card-border);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.status-strip-item {
    background: var(--card);
    padding: 18px 20px;
    text-align: center;
}
.status-strip-item .label {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 8px;
}
.status-strip-item .value {
    font-family: var(--display);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}
.status-strip-item .value .unit {
    font-family: var(--body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
}
.status-strip-item.accent .value { color: var(--accent); }
.status-strip-item.mint .value { color: var(--mint); }

/* ---------- CARDS ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.card h2 {
    margin: 0 0 18px;
    font-size: 15px;
    font-family: var(--display);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.card h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; }

/* ---------- FORMS ---------- */
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
    margin-top: 14px;
}
input, select, textarea {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14.5px;
    font-family: var(--body);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--card);
}
textarea { resize: vertical; min-height: 100px; }
input[type="date"], input[type="time"] { font-family: var(--mono); font-size: 13px; padding: 9px 10px; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }
.row.centered > div { text-align: center; }
.row.centered label { text-align: center; }

code {
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 2px 8px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--mint);
}

/* ---------- BUTTONS ---------- */
button {
    background: var(--accent);
    color: var(--accent-text-on);
    border: none;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14.5px;
    font-weight: 600;
    font-family: var(--body);
    margin-top: 18px;
    transition: all .15s ease;
    letter-spacing: -0.01em;
}
button:hover { background: var(--accent-hover); transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--card-border);
}
button.secondary:hover { background: var(--card-hover); border-color: var(--text-faint); transform: translateY(-1px); }

button.danger { background: var(--danger); }
button.danger:hover { background: #ff6b6b; }

button.small { padding: 7px 14px; font-size: 12px; margin-top: 0; border-radius: 7px; }

/* ---------- TABLES ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: center; padding: 12px 10px; border-bottom: 1px solid var(--card-border); }
th.title, td.title { text-align: left; }
th {
    color: var(--text-faint);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--mono);
}
td.title { max-width: 320px; font-weight: 500; }
tbody tr { transition: background .12s ease, box-shadow .12s ease; }
tbody tr:hover {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}
tbody tr:last-child td { border-bottom: none; }

/* ---------- BADGES ---------- */
.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--mono);
}
.badge.pending { background: var(--warning-soft); color: var(--warning); }
.badge.published { background: var(--mint-soft); color: var(--mint); }
.badge.ready { background: var(--mint-soft); color: var(--mint); }
.badge.error { background: var(--danger-soft); color: var(--danger); }
.badge.generating { background: var(--accent-soft); color: var(--accent); }

/* ---------- SITES LIST ---------- */
.site-list { display: flex; flex-direction: column; gap: 10px; }
.site-item {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    transition: border-color .15s ease;
    flex-wrap: wrap;
    gap: 10px;
}
.site-item:hover { border-color: var(--text-faint); }
.site-item .site-info { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.actions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.muted { color: var(--text-dim); font-size: 13px; }

/* ---------- STEPS (setup do site) ---------- */
.steps { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.step {
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-dim);
    flex: 1;
    min-width: 140px;
    text-align: center;
}
.step b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.log-box {
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 14px;
    line-height: 1.8;
    font-family: var(--mono);
    white-space: pre-wrap;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 980px) {
    .sidebar {
        width: 76px;
        padding: 18px 10px;
    }
    .brand-text, .sidebar-nav a span:last-child { display: none; }
    .sidebar-brand { justify-content: center; padding: 4px 0 24px; }
    .sidebar-nav a { justify-content: center; padding: 12px; }
    .sidebar-nav a.active::before { left: -10px; }
    .theme-toggle button span { display: none; }
    .topbar, .content { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 640px) {
    .sidebar { display: none; }
    .topbar, .content { padding-left: 16px; padding-right: 16px; }
}
