/* === ESTR-IG — Design System inspirado em PostHog + Arquitetura === */

:root {
    --canvas: #eeefe9;
    --surface-card: #ffffff;
    --surface-soft: #e5e7e0;
    --ink: #23251d;
    --body: #4d4f46;
    --mute: #6c6e63;
    --ash: #9b9c92;
    --hairline: #bfc1b7;

    --primary: #c17f59;
    --primary-hover: #a86d4a;
    --primary-soft: #f5ebe3;

    --accent-green: #5b8c5a;
    --accent-green-soft: #e6f2e5;
    --accent-blue: #4a7c96;
    --accent-blue-soft: #e3eef3;
    --accent-red: #c45b4a;
    --accent-red-soft: #f9e4df;

    --font-display: 'Georgia', 'Times New Roman', serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 1px 3px rgba(35,37,29,0.06), 0 1px 2px rgba(35,37,29,0.04);
    --shadow-elevated: 0 4px 12px rgba(35,37,29,0.08), 0 2px 4px rgba(35,37,29,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--canvas);
    color: var(--body);
    line-height: 1.6;
    font-size: 15px;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4 { color: var(--ink); font-weight: 700; letter-spacing: -0.3px; }
h1 { font-size: 28px; font-family: var(--font-display); }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--mute); }

/* === LAYOUT === */
.app-layout { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
    width: 240px;
    background: var(--surface-card);
    border-right: 1px solid var(--hairline);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 16px;
}

.sidebar-brand h2 {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--ink);
    letter-spacing: 1px;
}

.sidebar-brand span {
    font-size: 12px;
    color: var(--mute);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-nav { flex: 1; padding: 0 12px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--body);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    transition: all 0.15s;
}

.sidebar-nav a:hover { background: var(--surface-soft); color: var(--ink); }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.sidebar-nav .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--hairline);
    font-size: 13px;
}

.sidebar-footer .user-info { font-weight: 600; color: var(--ink); }
.sidebar-footer .user-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--mute);
    margin-top: 2px;
}

.sidebar-footer .logout-btn {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--mute);
    text-decoration: none;
}

.sidebar-footer .logout-btn:hover { color: var(--accent-red); }

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 32px 40px;
    max-width: 1200px;
}

/* === PAGE HEADER === */
.page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-header h1 { margin-bottom: 4px; }
.page-header .subtitle { color: var(--mute); font-size: 14px; }

/* === CARDS === */
.card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--hairline);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--hairline);
}

.stat-card .stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--mute);
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -1px;
    line-height: 1;
}

.stat-card .stat-change {
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red); }

/* === CHARTS === */
.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

@media (max-width: 900px) {
    .charts-row { grid-template-columns: 1fr; }
}

/* === TABLES === */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    padding: 12px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--mute);
    border-bottom: 2px solid var(--hairline);
    font-weight: 600;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--hairline);
    color: var(--ink);
}

tbody tr:hover { background: var(--surface-soft); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-feed { background: #e3eef3; color: #276678; }
.badge-carrossel { background: #e6f2e5; color: #3d6b3b; }
.badge-reels { background: #f5ebe3; color: #8b5742; }
.badge-stories { background: #f2e5f5; color: #6b3d7a; }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--surface-soft);
    color: var(--ink);
}

.btn-secondary:hover { background: var(--hairline); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover { background: var(--primary-soft); }

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #a84a3c; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--hairline);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--surface-card);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: end;
}

select.form-control { cursor: pointer; }

/* === MODAL === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(35,37,29,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 560px;
    box-shadow: var(--shadow-elevated);
    max-height: 85vh;
    overflow-y: auto;
}

.modal h2 { margin-bottom: 20px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* === PLAYBOOK === */
.playbook-section {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--hairline);
    margin-bottom: 20px;
}

.playbook-section h2 {
    font-family: var(--font-display);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.playbook-section h3 {
    color: var(--primary);
    margin-top: 20px;
    margin-bottom: 10px;
}

.playbook-section ul, .playbook-section ol { padding-left: 20px; margin: 10px 0; }
.playbook-section li { margin-bottom: 8px; line-height: 1.7; }

.tip-box {
    background: var(--primary-soft);
    border-left: 4px solid var(--primary);
    padding: 14px 18px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 16px 0;
    font-size: 14px;
}

.tip-box strong { color: var(--primary); }

/* === LOGIN PAGE === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--canvas);
}

.login-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-elevated);
    border: 1px solid var(--hairline);
    text-align: center;
}

.login-card h1 {
    font-family: var(--font-display);
    font-size: 28px;
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    color: var(--mute);
    font-size: 13px;
    margin-bottom: 28px;
}

/* === ALERTS === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success { background: var(--accent-green-soft); color: #2d5230; }
.alert-error { background: var(--accent-red-soft); color: #7a3026; }
.alert-info { background: var(--accent-blue-soft); color: #2d5266; }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--mute);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { color: var(--ink); margin-bottom: 8px; }

/* === PILL TABS === */
.pill-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.pill-tab {
    padding: 8px 18px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--body);
    border: 1.5px solid var(--hairline);
    transition: all 0.15s;
}

.pill-tab.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.pill-tab:hover:not(.active) { border-color: var(--ash); }

/* === UPLOAD ZONE === */
.upload-zone {
    border: 2px dashed var(--hairline);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin: 16px 0;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.upload-zone p { color: var(--mute); }
.upload-zone .upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-zone input[type="file"] { display: none; }

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .stat-card { animation: fadeIn 0.35s ease-out; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 3px; }
/* === CENTRAL DE REFERÊNCIAS === */

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.filter-chip {
    padding: 8px 16px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: var(--surface-card);
    color: var(--body);
    border: 1.5px solid var(--hairline);
    transition: all 0.15s;
}

.filter-chip:hover { border-color: var(--ash); background: var(--surface-soft); }

.filter-chip.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

/* Section Header */
.section-header {
    margin-bottom: 16px;
    margin-top: 8px;
}

.section-header h2 {
    font-size: 18px;
    color: var(--ink);
    font-weight: 700;
}

/* Reference Grid */
.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

/* Reference Card */
.ref-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--hairline);
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
}

.ref-card:hover {
    box-shadow: var(--shadow-elevated);
    border-color: var(--ash);
}

.ref-card-featured {
    border-left: 3px solid var(--primary);
}

.ref-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.ref-category {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.cat-cases { background: #fdf2e9; color: #b87333; }
.cat-artigos { background: #e8f0fe; color: #3c6ea8; }
.cat-tendencias { background: #f2e5f5; color: #7b3f8c; }
.cat-benchmarks { background: #e6f2e5; color: #3d6b3b; }
.cat-ferramentas { background: #fff3cd; color: #856404; }
.cat-cursos { background: #e3eef3; color: #276678; }
.cat-visuais { background: #fce4ec; color: #ad1457; }
.cat-outros { background: var(--surface-soft); color: var(--mute); }

.featured-star {
    font-size: 14px;
    animation: pulse-star 2s infinite;
}

@keyframes pulse-star {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ref-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
    flex: 1;
}

.ref-title a {
    color: var(--ink);
    text-decoration: none;
    transition: color 0.15s;
}

.ref-title a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.ref-desc {
    font-size: 13px;
    color: var(--mute);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tags */
.ref-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    background: var(--surface-soft);
    color: var(--mute);
}

/* Ref Meta */
.ref-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--hairline);
}

.ref-source {
    font-size: 12px;
    color: var(--ash);
    font-weight: 500;
}

.ref-date {
    font-size: 11px;
    color: var(--mute);
}

/* Icon Button */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    color: var(--ash);
    transition: all 0.15s;
    line-height: 1;
}

.btn-icon:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.btn-icon-danger:hover {
    background: var(--accent-red-soft);
    color: var(--accent-red);
}

/* Modal LG */
.modal-lg {
    max-width: 640px;
}

/* Responsive */
@media (max-width: 768px) {
    .ref-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        gap: 6px;
    }

    .filter-chip {
        padding: 6px 12px;
        font-size: 12px;
    }
}

::-webkit-scrollbar-thumb:hover { background: var(--ash); }

/* === PALETA DA SEMANA === */

.palette-hero {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--hairline);
    margin-bottom: 28px;
}

.palette-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.palette-header-row h2 {
    font-size: 28px;
    font-family: var(--font-display);
    margin: 4px 0;
}

.palette-mood {
    font-size: 16px;
    color: var(--primary);
    font-weight: 500;
}

.week-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-soft);
    color: var(--mute);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Color Bars (horizontal) */
.color-bars {
    display: flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 100px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-elevated);
}

.color-bar {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    transition: flex 0.3s ease;
}

.color-bar:hover { flex: 1.4; }

.color-hex {
    font-size: 12px;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.25s;
}

.color-bar:hover .color-hex {
    opacity: 1;
    transform: translateY(0);
}

/* Color Circles */
.color-circles {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 24px;
}

.color-circle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.color-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--surface-card);
    box-shadow: 0 2px 8px rgba(35,37,29,0.12), 0 0 0 1px var(--hairline);
    transition: transform 0.2s;
}

.color-circle:hover {
    transform: scale(1.15);
}

.circle-label {
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-weight: 600;
    color: var(--mute);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.palette-description-card {
    background: var(--surface-soft);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-top: 4px;
}

.palette-description-card h4 {
    margin-bottom: 8px;
    color: var(--ink);
    text-transform: none;
    letter-spacing: normal;
    font-size: 15px;
}

.palette-description-card p {
    color: var(--body);
    font-size: 14px;
    line-height: 1.8;
}

/* Palette History Grid */
.section-header {
    margin-bottom: 20px;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 20px;
}

.palette-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.palette-mini-card {
    background: var(--surface-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--hairline);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
}

.palette-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
}

.mini-bars {
    display: flex;
    height: 48px;
}

.mini-bar {
    flex: 1;
}

.mini-info {
    padding: 14px 16px;
}

.mini-week {
    font-size: 11px;
    font-weight: 600;
    color: var(--mute);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.mini-info strong {
    display: block;
    font-size: 15px;
    color: var(--ink);
    margin: 4px 0 2px;
}

.mini-mood {
    font-size: 13px;
    color: var(--primary);
}
