:root {
    /* Colors */
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --sidebar-bg: #1e293b;
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --secondary: #64748b;
    --accent: #10b981;
    --danger: #ef4444;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    
    /* Effects */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-dark: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.9);
    --sidebar-bg: #ffffff;
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --secondary: #94a3b8;
    --accent: #059669;
    --danger: #dc2626;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: rgba(0, 0, 0, 0.1);
    
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

[data-theme="light"] body {
    font-weight: 500;
}

[data-theme="light"] .btn {
    font-weight: 700;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-main);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: max-content;
    min-width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    transition: var(--transition);
    overflow-y: auto;
}

.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 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.brand-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 1.5rem;
}

.nav-links::-webkit-scrollbar {
    width: 4px;
}
.nav-links::-webkit-scrollbar-track {
    background: transparent;
}
.nav-links::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar.hidden {
    margin-left: -280px;
    padding: 0;
    border: none;
}

.nav-item {
    margin-bottom: 1rem;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.submenu .nav-link {
    padding-left: 2.5rem;
    font-size: 0.8rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-link.active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(56, 189, 248, 0.3);
}

.nav-link svg {
    width: 18px;
    height: 18px;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    overflow-y: auto;
    position: relative;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--secondary);
    border: 2px solid var(--border);
}

/* Dashboard Cards */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Content Sections */
.section-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.section-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Components */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 14px 0 rgba(56, 189, 248, 0.39);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    outline: none;
    transition: var(--transition);
}

input:focus, select:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Force dark dropdown in native select */
select {
    color-scheme: dark;
}

select option {
    background-color: #1e293b;
    color: #f1f5f9;
    padding: 0.5rem;
}

select option:hover,
select option:checked {
    background-color: #38bdf8;
    color: #0f172a;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 80px; padding: 1.5rem 0.5rem; }
    .brand-name, .nav-link span { display: none; }
    .nav-link { justify-content: center; }
}

/* Custom Logo Theme Toggle */
[data-theme="light"] #logo-clara {
    display: none !important;
}

[data-theme="light"] #logo-escura {
    display: block !important;
}

/* Assistente Digital */
.assistant-link:hover {
    background: rgba(128, 128, 128, 0.1) !important;
    color: var(--primary) !important;
}

#assistant-toggle-btn:hover {
    transform: translateY(-5px) scale(1.05);
}

/* =========================================
   Módulo E-Commerce (Tabs & Tabelas)
   ========================================= */

.ecommerce-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    overflow-x: auto;
}

.ecommerce-tabs::-webkit-scrollbar {
    height: 4px;
}

.ecom-tab {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
}

.ecom-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .ecom-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ecom-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.2);
}

[data-theme="light"] .ecom-tab.active {
    background: var(--primary);
    color: #fff;
}

.ecom-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.ecom-tab-content.active {
    display: block;
}

.ecom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.ecom-table th {
    background: rgba(255, 255, 255, 0.02);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .ecom-table th {
    background: rgba(0, 0, 0, 0.02);
}

.ecom-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.ecom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .ecom-table tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
[data-theme="light"] .custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

/* Customização para campos editáveis nas Fichas Técnicas */
#ficha-modal input[type="text"],
#ficha-modal input[type="number"],
#ficha-modal select,
#ficha-modal textarea {
    color: #000 !important;
    font-weight: bold !important;
}

@media print {
    body * {
        visibility: hidden;
    }
    #bureau-pdf-content, #bureau-pdf-content * {
        visibility: visible;
    }
    #bureau-pdf-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
}
