/* ============================================================
   Panificadora Pao da Vida - Painel Administrativo CSS
   Visual Profissional, Limpo, Sem Emojis, Responsivo
   ============================================================ */

:root {
    --admin-primary: #964f14;
    --admin-primary-dark: #7a3e0c;
    --admin-primary-light: #fef7ed;
    --admin-sidebar-bg: #1c231f;
    --admin-sidebar-text: #9ca3af;
    --admin-sidebar-active: #ffffff;
    --admin-bg: #f8fafc;
    --admin-surface: #ffffff;
    --admin-border: #e2e8f0;
    --admin-text: #1e293b;
    --admin-text-muted: #64748b;
    
    --badge-blue: #dbeafe;
    --badge-blue-text: #1e40af;
    --badge-green: #dcfce7;
    --badge-green-text: #166534;
    --badge-yellow: #fef9c3;
    --badge-yellow-text: #854d0e;
    --badge-gray: #f1f5f9;
    --badge-gray-text: #475569;
    --badge-red: #fee2e2;
    --badge-red-text: #991b1b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --font-admin: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body.admin-body {
    font-family: var(--font-admin);
    background-color: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    display: flex;
}

/* ============================================================
   Layout Principal Admin
   ============================================================ */
.admin-sidebar {
    width: 260px;
    background-color: var(--admin-sidebar-bg);
    color: var(--admin-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid #2d3748;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    object-fit: contain;
    background-color: #ffffff;
    padding: 2px;
}

.sidebar-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius);
    color: var(--admin-sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background-color: #2d3748;
    color: var(--admin-sidebar-active);
}

.nav-item.active {
    background-color: var(--admin-primary);
}

.nav-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    background-color: #dc2626;
    color: #ffffff;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #2d3748;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-footer a {
    color: #94a3b8;
    text-decoration: none;
}
.sidebar-footer a:hover {
    color: #ffffff;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: 64px;
    background-color: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--admin-text);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--admin-text-muted);
}

.admin-content {
    padding: 2rem;
    flex: 1;
}

/* ============================================================
   Cards & Widgets do Dashboard
   ============================================================ */
.stats-grid-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card-admin {
    background-color: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.stat-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--admin-primary);
    line-height: 1;
}

.stat-card-desc {
    font-size: 0.8rem;
    color: var(--admin-text-muted);
    margin-top: 0.5rem;
}

/* ============================================================
   Tabelas e Painéis Administrativos
   ============================================================ */
.panel {
    background-color: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    overflow: hidden;
}

.panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--admin-text);
}

.panel-body {
    padding: 1.5rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.table th {
    background-color: #f8fafc;
    color: var(--admin-text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--admin-border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* ============================================================
   Badges de Status
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-novo {
    background-color: var(--badge-blue);
    color: var(--badge-blue-text);
}

.badge-em_analise {
    background-color: var(--badge-yellow);
    color: var(--badge-yellow-text);
}

.badge-entrevistado {
    background-color: var(--badge-green);
    color: var(--badge-green-text);
}

.badge-arquivado {
    background-color: var(--badge-gray);
    color: var(--badge-gray-text);
}

.badge-descartado {
    background-color: var(--badge-red);
    color: var(--badge-red-text);
}

/* ============================================================
   Contadores de Caracteres SEO
   ============================================================ */
.char-counter-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--admin-text-muted);
}

.char-counter.good {
    color: #16a34a;
    font-weight: 600;
}

.char-counter.warning {
    color: #d97706;
    font-weight: 600;
}

.char-counter.danger {
    color: #dc2626;
    font-weight: 700;
}

/* ============================================================
   Biblioteca de Midia - Grid
   ============================================================ */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

.media-item {
    background-color: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.media-item:hover {
    border-color: var(--admin-primary);
    box-shadow: var(--shadow-md);
}

.media-thumb {
    height: 120px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-caption {
    padding: 0.6rem;
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   Modal de Selecao de Midia
   ============================================================ */
.admin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.admin-modal.open {
    display: flex;
}

.modal-content {
    background-color: var(--admin-surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 850px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
