/* ============================================================
   DessosaPro — CSS Global do Painel (Dashboard)
   Design System: Dark Premium + #F06523 Orange
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
    --orange: #C4161C;
    --orange-dark: #8E0E12;
    --orange-glow: rgba(196, 22, 28, 0.2);
    --bg: #0F0F10;
    --sidebar: #1C1C1E;
    --surface: #1C1C1E;
    --surface2: #252527;
    --border: rgba(255, 255, 255, 0.08);
    --text: #FFFFFF;
    --text-muted: #B3B3B3;
    --text-dim: #888;
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* ─── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--surface2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* ─── LAYOUT ESTRUTURA ──────────────────────────────────── */
.app-wrapper {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 260px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar.collapsed {
    width: 84px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 32px 0;
}

.sidebar.collapsed .btn-toggle-sidebar i {
    transform: rotate(180deg);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-width: 0;
    transition: var(--transition);
}

.sidebar.collapsed+.main-content {
    margin-left: 84px;
}

/* ─── SIDEBAR COMPONENTS ────────────────────────────────── */
.sidebar-header {
    padding: 32px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.btn-toggle-sidebar {
    position: absolute;
    right: -12px;
    top: 40px;
    width: 24px;
    height: 24px;
    background: var(--orange);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    transition: var(--transition);
}

.btn-toggle-sidebar:hover {
    background: var(--orange-dark);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--orange);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-group {
    padding: 0 16px;
    margin-bottom: 24px;
}

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0 12px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    background: var(--orange-glow);
    color: var(--orange);
}

.sidebar-footer {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── TOPBAR ────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.page-title p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 🔎 BUSCA RÁPIDA */
.quick-search {
    position: relative;
    width: 320px;
    display: flex;
    align-items: center;
}

.quick-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 16px;
    pointer-events: none;
    z-index: 5;
}

.quick-search input {
    width: 100%;
    min-width: 260px;
    background: #1C1C1E !important;
    border: 1px solid var(--border);
    padding: 10px 45px 10px 40px;
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.quick-search input:focus {
    border-color: var(--orange);
    background: #252527 !important;
    box-shadow: 0 0 0 3px rgba(196, 22, 28, 0.1);
}

.search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
    text-transform: uppercase;
    z-index: 5;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-mobile-menu {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .btn-mobile-menu {
        display: flex;
    }
}

.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--orange);
    border-radius: 50%;
    border: 2px solid var(--bg);
}

.action-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── CARDS & DASHBOARD ─────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(196, 22, 28, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--orange);
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    margin: 4px 0;
}

.stat-trend {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: #22c55e;
}

.trend-down {
    color: #ef4444;
}

/* ─── TABELAS ───────────────────────────────────────────── */
.card-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(255, 255, 255, 0.02);
    text-align: left;
    padding: 16px 24px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px 24px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text);
}

.badge {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.badge-neutral {
    background: var(--surface2);
    color: var(--text-muted);
}

/* ─── BOTÕES INTERNOS ───────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--orange);
    color: #fff;
}

.btn-primary:hover {
    background: var(--orange-dark);
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── FORMULÁRIOS ───────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px var(--orange-glow);
}

/* ─── RESPONSIVO ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar .logo-text,
    .sidebar .nav-label,
    .sidebar .nav-link span,
    .sidebar .user-info {
        display: none;
    }

    .sidebar .nav-group {
        padding: 0 8px;
    }

    .main-content {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .header-left {
        width: 100%;
        gap: 12px;
    }

    .quick-search {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ─── ANIMAÇÕES & SKELETON ─────────────────────────────── */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Aplicar animação aos cards */
.stat-card {
    animation: fadeIn 0.4s ease-out both;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}