:root {
    --preto-fosco: #171717;
    --preto-escuro: #0B0B0B;
    --laranja: #CD4C00;
    --laranja-hover: #E85D00;
    --laranja-glow: rgba(205, 76, 0, 0.3);
    --cinza: #2E2E2E;
    --cinza-claro: #3A3A3A;
    --branco: #FFFFFF;
    --texto: #E8E8E8;
    --texto-muted: #9A9A9A;
    --glass-bg: rgba(46, 46, 46, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --preto-fosco: #F5F5F5;
    --preto-escuro: #FFFFFF;
    --cinza: #E8E8E8;
    --cinza-claro: #D0D0D0;
    --texto: #1A1A1A;
    --texto-muted: #666666;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--preto-escuro);
    color: var(--texto);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--preto-escuro); }
::-webkit-scrollbar-thumb { background: var(--cinza); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--laranja); }

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Login */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--preto-escuro) 0%, var(--preto-fosco) 50%, #1a0a00 100%);
    z-index: 0;
}

.login-bg::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--laranja-glow) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    margin: 1rem;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--laranja), #FF6B1A);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: white;
    box-shadow: 0 8px 24px var(--laranja-glow);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--preto-fosco);
    border-right: 1px solid var(--glass-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--branco);
}

.sidebar-logo i {
    color: var(--laranja);
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--texto-muted);
    padding: 0.75rem 1rem 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    color: var(--texto-muted);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(205, 76, 0, 0.1);
    color: var(--texto);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--laranja), #E85D00);
    color: white;
    box-shadow: 0 4px 12px var(--laranja-glow);
}

.nav-item i { width: 20px; text-align: center; font-size: 0.95rem; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--cinza);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--laranja);
}

.user-name { font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.75rem; color: var(--texto-muted); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    border-radius: 0 !important;
    border-left: none;
    border-right: none;
    border-top: none;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
}

.topbar-actions { display: flex; gap: 0.5rem; }

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--texto-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.btn-icon:hover {
    background: var(--cinza);
    color: var(--laranja);
}

.badge-notif {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--laranja);
    color: white;
    font-size: 0.65rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.content-area {
    padding: 1.5rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cards */
.stat-card {
    padding: 1.5rem;
    transition: var(--transition);
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--texto-muted);
    font-weight: 500;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--laranja), #E85D00);
    border: none;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--laranja-hover), #FF6B1A);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--laranja-glow);
}

.btn-outline-primary {
    border-color: var(--laranja);
    color: var(--laranja);
    border-radius: 8px;
    font-weight: 600;
}

.btn-outline-primary:hover {
    background: var(--laranja);
    border-color: var(--laranja);
}

/* Forms */
.form-control, .form-select {
    background: var(--cinza);
    border: 1px solid var(--glass-border);
    color: var(--texto);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
}

.form-control:focus, .form-select:focus {
    background: var(--cinza-claro);
    border-color: var(--laranja);
    color: var(--texto);
    box-shadow: 0 0 0 3px var(--laranja-glow);
}

.form-control::placeholder { color: var(--texto-muted); }

.input-group-text {
    background: var(--cinza);
    border: 1px solid var(--glass-border);
    color: var(--texto-muted);
}

.form-label { color: var(--texto-muted); font-size: 0.85rem; font-weight: 500; }

/* Tables */
.table-dark-custom {
    --bs-table-bg: transparent;
    color: var(--texto);
}

.table-dark-custom thead th {
    background: var(--cinza);
    border-bottom: 2px solid var(--laranja);
    color: var(--texto-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding: 0.85rem 1rem;
}

.table-dark-custom tbody td {
    padding: 0.75rem 1rem;
    border-color: var(--glass-border);
    vertical-align: middle;
}

.table-dark-custom tbody tr {
    transition: var(--transition);
}

.table-dark-custom tbody tr:hover {
    background: rgba(205, 76, 0, 0.05);
}

/* Badges */
.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: #22C55E; }
.badge-warning { background: rgba(234, 179, 8, 0.15); color: #EAB308; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #EF4444; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #3B82F6; }
.badge-orange { background: rgba(205, 76, 0, 0.15); color: var(--laranja); }

/* Chart containers */
.chart-container {
    padding: 1.5rem;
    position: relative;
    min-height: 300px;
}

/* PDV */
.pdv-container { display: grid; grid-template-columns: 1fr 380px; gap: 1rem; height: calc(100vh - var(--topbar-height) - 3rem); }

.pdv-produtos {
    overflow-y: auto;
    padding-right: 0.5rem;
}

.pdv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.pdv-produto-card {
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.pdv-produto-card:hover {
    border-color: var(--laranja);
    transform: scale(1.03);
}

.pdv-produto-card .produto-img {
    width: 60px;
    height: 60px;
    background: var(--cinza);
    border-radius: 10px;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--texto-muted);
}

.pdv-produto-card .produto-nome {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.pdv-produto-card .produto-preco {
    color: var(--laranja);
    font-weight: 700;
    font-size: 0.9rem;
}

.pdv-carrinho {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pdv-carrinho-items {
    flex: 1;
    overflow-y: auto;
}

.pdv-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.pdv-total {
    padding: 1rem;
    border-top: 2px solid var(--laranja);
}

.pdv-total-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--laranja);
}

/* Notifications Panel */
.notif-panel {
    position: fixed;
    top: calc(var(--topbar-height) + 8px);
    right: 1rem;
    width: 360px;
    max-height: 480px;
    z-index: 200;
    overflow: hidden;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition);
}

.notif-item:hover { background: rgba(205, 76, 0, 0.05); }

.notif-item .notif-tipo {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--laranja);
    font-weight: 600;
}

/* Modal */
.modal-content { background: var(--preto-fosco) !important; color: var(--texto); }
.modal-header, .modal-footer { border-color: var(--glass-border) !important; }

/* Alert cards */
.alert-card {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.alert-card i { font-size: 1.2rem; }

/* Delivery status */
.status-timeline {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.status-step {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--cinza);
    color: var(--texto-muted);
    transition: var(--transition);
}

.status-step.active {
    background: var(--laranja);
    color: white;
}

.status-step.done {
    background: rgba(34, 197, 94, 0.2);
    color: #22C55E;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .pdv-container { grid-template-columns: 1fr; height: auto; }
}

@media (max-width: 575.98px) {
    .content-area { padding: 1rem; }
    .stat-value { font-size: 1.35rem; }
    .pdv-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Loading */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spinner-custom {
    width: 40px;
    height: 40px;
    border: 3px solid var(--cinza);
    border-top-color: var(--laranja);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--texto-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h4 { font-weight: 700; margin: 0; }

/* Search bar */
.search-bar {
    position: relative;
    max-width: 320px;
}

.search-bar input {
    padding-left: 2.5rem;
}

.search-bar i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--texto-muted);
}

/* Tabs custom */
.nav-tabs-custom {
    border-bottom: 2px solid var(--glass-border);
    gap: 0.25rem;
}

.nav-tabs-custom .nav-link {
    color: var(--texto-muted);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0;
    transition: var(--transition);
}

.nav-tabs-custom .nav-link:hover { color: var(--texto); }
.nav-tabs-custom .nav-link.active {
    color: var(--laranja);
    border-bottom-color: var(--laranja);
    background: transparent;
}

/* Print */
@media print {
    .sidebar, .topbar, .btn { display: none !important; }
    .main-content { margin-left: 0; }
    body { background: white; color: black; }
}
