/**
 * ====================================================================
 * CoreBiz Admin — Design System Completo
 * Complementa o main.css do CoreBiz com componentes específicos do Painel
 * Autor: LEVSTECH | Compatível com Bootstrap 5.3 + CoreBiz main.css
 * ====================================================================
 */

/* ------------------------------------------------------------------
   0. Variáveis Complementares do Admin
------------------------------------------------------------------ */
:root {
  --accent-light: rgba(9, 148, 125, 0.10);
  --admin-sidebar-bg: #f7fbfa;
  --admin-card-radius: 12px;
  --admin-transition: all 0.25s ease;
}

/* ------------------------------------------------------------------
   1. Layout Geral do Admin (Body + Main)
------------------------------------------------------------------ */
body.index-page {
  background-color: #f7fbfa;
}

.main .section {
  padding: 1.5rem 0 2rem;
}

.page-title {
  padding: 1rem 0;
  background: linear-gradient(135deg, #172624 0%, #09947d 100%);
}

.page-title h1 {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--heading-font);
  margin-bottom: 0;
}

.page-title .breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem;
  align-items: center;
}

.page-title .breadcrumbs ol li {
  color: rgba(255,255,255,0.65);
  font-size: 0.82rem;
}

.page-title .breadcrumbs ol li a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  transition: color 0.2s;
}

.page-title .breadcrumbs ol li a:hover {
  color: #ffffff;
}

.page-title .breadcrumbs ol li.current {
  color: #ffffff;
  font-weight: 600;
}

.page-title .breadcrumbs ol li + li::before {
  content: '/';
  margin-right: 0.5rem;
  color: rgba(255,255,255,0.4);
}

/* ------------------------------------------------------------------
   2. Cards & Stat Cards no Estilo CoreBiz
------------------------------------------------------------------ */
.card {
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--admin-card-radius);
  background-color: var(--surface-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: var(--admin-transition);
}

.card-header {
  background-color: var(--surface-color);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-family: var(--heading-font);
  font-weight: 600;
  color: var(--heading-color);
  padding: 1rem 1.35rem;
  border-top-left-radius: var(--admin-card-radius) !important;
  border-top-right-radius: var(--admin-card-radius) !important;
}

.stat-card {
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--admin-card-radius);
  background-color: var(--surface-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
  position: relative;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.10);
  border-color: rgba(9, 148, 125, 0.25);
}

.stat-card .stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.stat-card:hover .stat-icon-wrapper {
  transform: scale(1.08);
}

.stat-card .metric-number {
  font-family: var(--heading-font);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--heading-color);
  line-height: 1.15;
}

.stat-card .metric-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--default-color);
  opacity: 0.75;
  font-family: var(--nav-font);
  margin-bottom: 0.25rem;
  display: block;
}

/* ------------------------------------------------------------------
   3. Badges e Indicadores de Status
------------------------------------------------------------------ */
.badge-corebiz {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.32rem 0.68rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-corebiz-success {
  background-color: rgba(9, 148, 125, 0.10);
  color: #09947d;
  border: 1px solid rgba(9, 148, 125, 0.28);
}

.badge-corebiz-info {
  background-color: rgba(2, 132, 199, 0.10);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.28);
}

.badge-corebiz-warning {
  background-color: rgba(217, 119, 6, 0.10);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.28);
}

.badge-corebiz-danger {
  background-color: rgba(223, 21, 41, 0.10);
  color: #df1529;
  border: 1px solid rgba(223, 21, 41, 0.28);
}

.badge-corebiz-dark {
  background-color: rgba(23, 38, 36, 0.08);
  color: #172624;
  border: 1px solid rgba(23, 38, 36, 0.18);
}

.badge-corebiz-secondary {
  background-color: rgba(108, 117, 125, 0.10);
  color: #6c757d;
  border: 1px solid rgba(108, 117, 125, 0.28);
}

/* ------------------------------------------------------------------
   4. Tabelas no Padrão CoreBiz
------------------------------------------------------------------ */
.table {
  color: var(--default-color);
  margin-bottom: 0;
}

.table thead th {
  background-color: rgba(0,0,0,0.02);
  color: var(--heading-color);
  font-family: var(--nav-font);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid rgba(0,0,0,0.06);
  padding: 0.85rem 1.15rem;
  white-space: nowrap;
}

.table tbody td {
  padding: 0.90rem 1.15rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-hover tbody tr:hover {
  background-color: rgba(9, 148, 125, 0.03);
}

/* ------------------------------------------------------------------
   5. Terminal de Logs de Backup
------------------------------------------------------------------ */
.log-terminal {
  background-color: #0d1715;
  color: #2ee2c2;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.84rem;
  max-height: 420px;
  overflow-y: auto;
  border-radius: 8px;
  padding: 1.25rem;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid #1a332d;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  line-height: 1.6;
}

/* ------------------------------------------------------------------
   6. Formulários no Estilo CoreBiz
------------------------------------------------------------------ */
.form-control,
.form-select {
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 0.60rem 0.90rem;
  font-size: 0.92rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color: var(--default-color);
  background-color: #ffffff;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(9, 148, 125, 0.15);
  outline: none;
}

.form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--heading-color);
  margin-bottom: 0.4rem;
}

.input-group-text {
  border-radius: 8px 0 0 8px;
  border-color: rgba(0,0,0,0.12);
}

.input-group .form-control {
  border-radius: 0 8px 8px 0;
}

/* ------------------------------------------------------------------
   7. Botões no Estilo CoreBiz
------------------------------------------------------------------ */
.btn-primary {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
  font-weight: 600;
  border-radius: 6px;
  transition: var(--admin-transition);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: color-mix(in srgb, var(--accent-color), #000 12%);
  border-color: color-mix(in srgb, var(--accent-color), #000 12%);
  color: #ffffff;
}

.btn-outline-primary {
  border-color: var(--accent-color);
  color: var(--accent-color);
  font-weight: 600;
  border-radius: 6px;
  transition: var(--admin-transition);
}

.btn-outline-primary:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
}

/* ------------------------------------------------------------------
   8. Modais no Estilo CoreBiz
------------------------------------------------------------------ */
.modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 1.25rem 1.5rem;
}

.modal-footer {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 1rem 1.5rem;
}

/* ------------------------------------------------------------------
   9. Alertas no Estilo CoreBiz
------------------------------------------------------------------ */
.alert {
  border-radius: 10px;
  font-size: 0.9rem;
}

.alert-success {
  background-color: rgba(9, 148, 125, 0.08);
  border-color: rgba(9, 148, 125, 0.25);
  color: #09947d;
}

.alert-danger {
  background-color: rgba(223, 21, 41, 0.08);
  border-color: rgba(223, 21, 41, 0.25);
  color: #df1529;
}

.alert-warning {
  background-color: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.25);
  color: #d97706;
}

.alert-info {
  background-color: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
  color: #0284c7;
}

/* ------------------------------------------------------------------
   10. Preloader CoreBiz
------------------------------------------------------------------ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  background-color: #ffffff;
  transition: all 0.6s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

#preloader:not(.preloader-hide) {
  display: flex;
}

#preloader div {
  width: 13px;
  height: 13px;
  background: var(--accent-color);
  border-radius: 50%;
  animation: preloader-dots 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  margin: 0 5px;
}

#preloader div:nth-child(1) { animation-delay: -0.45s; }
#preloader div:nth-child(2) { animation-delay: -0.30s; }
#preloader div:nth-child(3) { animation-delay: -0.15s; }

@keyframes preloader-dots {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ------------------------------------------------------------------
   11. Scroll Top Button
------------------------------------------------------------------ */
.scroll-top {
  position: fixed;
  visibility: hidden;
  opacity: 0;
  right: 15px;
  bottom: 15px;
  z-index: 99999;
  background-color: var(--accent-color);
  width: 40px;
  height: 40px;
  border-radius: 4px;
  transition: all 0.4s;
  font-size: 1.25rem;
  color: #ffffff;
}

.scroll-top:hover {
  background-color: color-mix(in srgb, var(--accent-color), transparent 20%);
  color: #ffffff;
}

.scroll-top.active {
  visibility: visible;
  opacity: 1;
}

/* ------------------------------------------------------------------
   12. Nav active states no Admin
------------------------------------------------------------------ */
#navmenu ul li a.active {
  color: var(--nav-hover-color);
}

/* ------------------------------------------------------------------
   13. Utilitários Extras
------------------------------------------------------------------ */
.font-monospace {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
}

.text-accent {
  color: var(--accent-color) !important;
}

.bg-accent {
  background-color: var(--accent-color) !important;
}

.border-accent {
  border-color: var(--accent-color) !important;
}

/* Card hover lift */
.card:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.07);
}

/* Pagination no estilo CoreBiz */
.page-link {
  color: var(--accent-color);
  border-radius: 6px;
  margin: 0 2px;
  transition: var(--admin-transition);
}

.page-link:hover,
.page-item.active .page-link {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
}

/* ------------------------------------------------------------------
   14. Layout Admin com Sidebar
------------------------------------------------------------------ */
body.admin-body {
    background-color: #f4f7f6;
    margin: 0;
    overflow-x: hidden;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: #172624;
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    z-index: 1040;
}

.admin-sidebar-header {
    padding: 1.25rem 1.5rem;
    background: #0d1e1c;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-sidebar-header .logo {
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    font-family: var(--heading-font);
}

.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.admin-sidebar-nav .nav-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 1rem 1.5rem 0.5rem;
    font-weight: 700;
}

.admin-sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-sidebar-nav .nav-item .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    gap: 0.75rem;
}

.admin-sidebar-nav .nav-item .nav-link i {
    font-size: 1.15rem;
}

.admin-sidebar-nav .nav-item .nav-link:hover,
.admin-sidebar-nav .nav-item .nav-link.active {
    color: #2ee2c2;
    background: rgba(46, 226, 194, 0.05);
    border-right: 3px solid #2ee2c2;
}

/* Main Content Wrapper */
.admin-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: all 0.3s;
}

/* Topbar */
.admin-topbar {
    height: 65px;
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #172624;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    display: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #172624;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: var(--accent-light);
    color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Mobile responsive */
@media (max-width: 991.98px) {
    .sidebar-toggle { display: block; }
    
    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -260px;
        box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    }
    
    .admin-sidebar.show { left: 0; }
    
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1030;
        display: none;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    .sidebar-backdrop.show {
        display: block;
        opacity: 1;
    }
}

/* ------------------------------------------------------------------
   15. Ajuste de Botões no Page Title Escuro
------------------------------------------------------------------ */
.page-title .btn-outline-danger {
    color: #ff6b6b;
    border-color: #ff6b6b;
}
.page-title .btn-outline-danger:hover,
.page-title .btn-outline-danger:focus {
    background-color: #ff6b6b;
    color: #fff;
}

.page-title .btn-outline-primary {
    color: #2ee2c2;
    border-color: #2ee2c2;
}
.page-title .btn-outline-primary:hover,
.page-title .btn-outline-primary:focus {
    background-color: #2ee2c2;
    color: #172624;
}

.page-title .btn-primary {
    background-color: #2ee2c2;
    color: #172624;
    border-color: #2ee2c2;
    font-weight: 600;
}
.page-title .btn-primary:hover,
.page-title .btn-primary:focus {
    background-color: #fff;
    border-color: #fff;
    color: #172624;
}

.page-title .btn-outline-secondary {
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.5);
}
.page-title .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}
