/* ============================================================
   COMMERCEFLOW — MODERN UI v1.0
   Camada de polimento global: animações, profundidade e
   micro-interações. Carrega por último e segue a cor do
   sistema via var(--primary).
   ============================================================ */

/* ── TRANSIÇÃO DE PÁGINA ────────────────────────────────────
   Todo conteúdo novo injetado em #contentArea entra animado */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.content-area > * {
    animation: pageIn .35s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
    border-right: 1px solid var(--gray-100);
}

.sidebar .logo i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    font-size: 18px;
    color: var(--primary-contrast);
    background: var(--primary-grad);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .35);
}

.menu-item {
    position: relative;
    overflow: hidden;
}

.menu-item:hover {
    background: var(--primary-tint);
    color: var(--gray-900);
    transform: translateX(3px);
}

.menu-item:hover i {
    color: var(--primary-dark);
}

.menu-item.active {
    background: var(--primary-grad);
    color: var(--primary-contrast);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), .35);
}

.menu-item.active i {
    color: var(--primary-contrast);
}

/* Badge de notificação no menu segue o accent */
.menu-item.active .menu-notif-badge {
    background: var(--primary-contrast);
    color: var(--primary);
}

/* ── HEADER com efeito glass ────────────────────────────────── */
.top-header {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid var(--gray-100);
}

.header-icon,
.notif-bell-btn {
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.header-icon:hover,
.notif-bell-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-tint);
    color: var(--primary-darker);
}

/* Sininho balança ao passar o mouse */
@keyframes bellRing {
    0%, 100% { transform: rotate(0); }
    20%      { transform: rotate(14deg); }
    40%      { transform: rotate(-12deg); }
    60%      { transform: rotate(8deg); }
    80%      { transform: rotate(-6deg); }
}

.notif-bell-btn:hover i {
    animation: bellRing .6s ease;
    display: inline-block;
}

/* ── BOTÕES ─────────────────────────────────────────────────── */
.btn-primary {
    background: var(--primary-grad);
    color: var(--primary-contrast);
}

.btn-primary:hover {
    background: var(--primary-grad);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn:active {
    transform: scale(0.97);
}

/* ── CARDS com elevação no hover ────────────────────────────── */
.metric-card,
.chart-card,
.stat-card,
.dashboard-card,
.relatorio-card,
.quick-action-card {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.metric-card:hover,
.stat-card:hover,
.quick-action-card:hover,
.relatorio-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ── INPUTS: foco com a cor do sistema ──────────────────────── */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18) !important;
}

/* ── SCROLLBARS ─────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-soft);
    background-clip: content-box;
}

/* ── SELEÇÃO DE TEXTO ───────────────────────────────────────── */
::selection {
    background: rgba(var(--primary-rgb), 0.3);
}

/* ── TABELAS: linha destacada ───────────────────────────────── */
.data-table tbody tr,
.product-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover,
.product-table tbody tr:hover {
    background: var(--primary-tint);
}

/* ── MODAIS: entrada suave ──────────────────────────────────── */
@keyframes modalPop {
    from { opacity: 0; transform: translateY(22px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-container,
.modal-content,
.modal-box {
    animation: modalPop .3s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}

/* ── ACESSIBILIDADE ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .content-area > *,
    .modal-container,
    .modal-content,
    .modal-box {
        animation: none !important;
    }

    .menu-item:hover,
    .metric-card:hover,
    .stat-card:hover,
    .quick-action-card:hover,
    .relatorio-card:hover,
    .header-icon:hover,
    .notif-bell-btn:hover {
        transform: none !important;
    }
}
