/* admin/css/admin_style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700;800&display=swap');

/* ════════════════════════════════════════════════════════
   VARIÁVEIS E RESET
════════════════════════════════════════════════════════ */
:root {
    --color-primary:   #2BB673;
    --color-primary-d: #249961;
    --color-secondary: #2C7DA0;
    --color-dark:      #0F172A;      /* sidebar fundo */
    --color-dark-2:    #1E293B;      /* sidebar itens hover */
    --color-dark-3:    #334155;      /* bordas sutis */
    --color-light:     #F1F5F9;
    --color-white:     #FFFFFF;
    --color-danger:    #EF4444;
    --color-success:   #10B981;
    --color-text:      #1E293B;
    --color-text-muted:#64748B;
    --font-main:       'Inter', sans-serif;
    --sidebar-width:   260px;
    --radius:          10px;
    --transition:      all 0.2s ease;
    --shadow-sm:       0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:       0 4px 12px rgba(0,0,0,0.10);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; }

body {
    font-family: var(--font-main);
    background-color: var(--color-light);
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* ════════════════════════════════════════════════════════
   SIDEBAR NOVA
════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-dark);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;

    /* Scrollbar fina e discreta */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* ── Brand / Header ── */
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 24px 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

/* Logotipo (quando existe imagem) */
.sidebar-logo-link {
    display: block;
    line-height: 0;
}
.sidebar-logo-img {
    max-height: 40px;
    max-width: 140px;
    width: auto;
    object-fit: contain;
    filter: brightness(1.05);
    /* Sombra suave para logos escuros em fundo escuro */
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35)) brightness(1.05);
    border-radius: 6px;
}

/* Ícone fallback (quando não há logo) */
.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(43,182,115,0.4);
    margin: 0 auto;
}
.sidebar-brand-texts {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}
.sidebar-brand-title {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: #F8FAFC;
    letter-spacing: 0.02em;
}
.sidebar-brand-sub {
    display: block;
    font-size: 0.68rem;
    color: #64748B;
    margin-top: 1px;
    font-weight: 400;
}

/* ── Nav Container ── */
.sidebar-nav {
    padding: 12px 0 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Section Labels ── */
.sidebar-section-label {
    padding: 20px 10px 7px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    /* Cor diferenciada — verde-menta apagado, claramente distinto dos links */
    color: var(--color-primary);
    opacity: 0.55;
    text-align: center;
    /* Separador com linhas laterais */
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-section-label::before,
.sidebar-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.07);
}

/* ── Menu List ── */
.sidebar-menu {
    list-style: none;
    padding: 0 10px;
    margin-bottom: 4px;
}
.sidebar-menu-bottom {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-left: 10px;
    margin-right: 10px;
    padding-left: 0;
    padding-right: 0;
}

/* ── Links ── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #94A3B8;
    font-size: 0.84rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    margin-bottom: 2px;
}

/* Hover */
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #E2E8F0;
}
.sidebar-link:hover .sidebar-icon {
    color: var(--color-primary);
    transform: scale(1.1);
}

/* Ativo */
.sidebar-link.active {
    background: linear-gradient(90deg, rgba(43,182,115,0.18), rgba(43,182,115,0.06));
    color: #FFFFFF;
    font-weight: 600;
}
.sidebar-link.active .sidebar-icon {
    color: var(--color-primary);
}
/* Barra lateral verde no ativo */
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -10px; /* Fora do padding do ul */
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}

/* ── Ícone ── */
.sidebar-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(255,255,255,0.04);
    color: #64748B;
    flex-shrink: 0;
    transition: var(--transition);
}
.sidebar-link.active .sidebar-icon {
    background: rgba(43,182,115,0.15);
}

/* ── Label ── */
.sidebar-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Logout ── */
.sidebar-link-logout {
    color: #94A3B8;
}
.sidebar-link-logout:hover {
    background: rgba(239,68,68,0.12);
    color: #FCA5A5;
}
.sidebar-link-logout:hover .sidebar-icon {
    color: #EF4444;
    transform: translateX(2px) scale(1.05);
}

/* ════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL
════════════════════════════════════════════════════════ */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Topbar ── */
.topbar {
    background: var(--color-white);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid #F1F5F9;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
}

/* ── Content ── */
.content-wrapper {
    padding: 28px;
    flex: 1;
}

/* ════════════════════════════════════════════════════════
   LOGIN
════════════════════════════════════════════════════════ */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-dark) 0%, #1E293B 50%, #0F172A 100%);
}
.login-card {
    background: var(--color-white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}
.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--color-text);
    font-size: 1.4rem;
}

/* ════════════════════════════════════════════════════════
   FORMULÁRIOS
════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #E2E8F0;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 0.9rem;
    color: var(--color-text);
    transition: var(--transition);
    background: white;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(43,182,115,0.12);
}
.form-control::placeholder { color: #CBD5E1; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ════════════════════════════════════════════════════════
   BOTÕES
════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-main);
    font-size: 0.85rem;
    text-align: center;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-block { width: 100%; }
.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(43,182,115,0.3);
}
.btn-primary:hover {
    background: var(--color-primary-d);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(43,182,115,0.4);
}
.btn-danger {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}
.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

/* ════════════════════════════════════════════════════════
   ALERTS
════════════════════════════════════════════════════════ */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.88rem;
    font-weight: 500;
}
.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

/* ════════════════════════════════════════════════════════
   TABELAS
════════════════════════════════════════════════════════ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 560px;
}
.table th, .table td {
    padding: 13px 16px;
    text-align: left;
    border-bottom: 1px solid #F1F5F9;
    white-space: nowrap;
}
.table th {
    background: #F8FAFC;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}
.table tbody tr:hover { background: #FAFBFC; }
.table tbody tr:last-child td { border-bottom: none; }

/* ════════════════════════════════════════════════════════
   BADGES
════════════════════════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}
.badge-success   { background: #D1FAE5; color: #065F46; }
.badge-warning   { background: #FEF3C7; color: #92400E; }
.badge-danger    { background: #FEE2E2; color: #991B1B; }
.badge-info      { background: #DBEAFE; color: #1E40AF; }
.badge-secondary { background: #F1F5F9; color: #475569; }

/* ════════════════════════════════════════════════════════
   OVERLAY MOBILE
════════════════════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* Botão hamburguer no topbar */
.topbar-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 7px;
    color: var(--color-text);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.topbar-menu-btn:hover { background: var(--color-light); }
.topbar-menu-btn svg { width: 22px; height: 22px; }

/* ════════════════════════════════════════════════════════
   RESPONSIVO MOBILE
════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0 !important; width: 100%; }

    .topbar { padding: 12px 16px; }
    .topbar-menu-btn { display: flex; margin-right: 10px; }
    .topbar h2 { font-size: 0.95rem; }

    .content-wrapper { padding: 14px; }

    .stats-grid, .dash-grid { grid-template-columns: 1fr !important; }
    .form-row, .row { flex-direction: column !important; }
    .form-col, .col { width: 100% !important; max-width: 100% !important; }

    .btn { width: 100%; margin-bottom: 8px; }
    .btn + .btn { margin-left: 0 !important; }

    .table th, .table td { padding: 10px 12px; font-size: 0.82rem; }

    .login-card { padding: 28px 20px; margin: 16px; }
}
