/* ============================================
   Cores da Marca Volkswagen
   ============================================ */
:root {
    --vw-blue-dark: #001E50;
    --vw-blue: #0066CC;
    --vw-blue-light: #4A90E2;
    --vw-white: #FFFFFF;
    --vw-gray-light: #F5F5F5;
    --vw-gray: #666666;
    --vw-gray-dark: #333333;
    --vw-green: #4CAF50;
    --vw-orange: #FF9800;
    --vw-red: #F44336;
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

/* ============================================
   Reset e Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--vw-gray-light);
    color: var(--vw-gray-dark);
    overflow-x: hidden;
}

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--vw-blue-dark) 0%, var(--vw-blue) 100%);
    color: var(--vw-white);
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.logo i {
    font-size: 28px;
    color: var(--vw-blue-light);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.menu-item {
    margin: 5px 0;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.menu-item a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--vw-white);
    border-left-color: var(--vw-blue-light);
}

.menu-item.active a {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--vw-white);
    border-left-color: var(--vw-blue-light);
    font-weight: 500;
}

.menu-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.user-info i {
    font-size: 24px;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ============================================
   Top Bar
   ============================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--vw-white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--vw-gray-dark);
    cursor: pointer;
    margin-right: 20px;
}

.topbar-title h1 {
    font-size: 24px;
    font-weight: 500;
    color: var(--vw-blue-dark);
    flex: 1;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--vw-gray-light);
    color: var(--vw-gray-dark);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--vw-blue);
    color: var(--vw-white);
    transform: translateY(-2px);
}

/* ============================================
   Page Content
   ============================================ */
.page-content {
    padding: 30px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.page-header {
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 32px;
    font-weight: 500;
    color: var(--vw-blue-dark);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--vw-gray);
    font-size: 16px;
}

/* ============================================
   KPI Cards
   ============================================ */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--vw-white);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--vw-white);
}

.kpi-icon.blue {
    background: linear-gradient(135deg, var(--vw-blue) 0%, var(--vw-blue-light) 100%);
}

.kpi-icon.green {
    background: linear-gradient(135deg, var(--vw-green) 0%, #66BB6A 100%);
}

.kpi-icon.orange {
    background: linear-gradient(135deg, var(--vw-orange) 0%, #FFB74D 100%);
}

.kpi-icon.red {
    background: linear-gradient(135deg, var(--vw-red) 0%, #EF5350 100%);
}

.kpi-content {
    flex: 1;
}

.kpi-content h3 {
    font-size: 14px;
    color: var(--vw-gray);
    font-weight: 400;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--vw-blue-dark);
    margin-bottom: 5px;
}

.kpi-change {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 500;
}

.kpi-change.positive {
    color: var(--vw-green);
}

.kpi-change.negative {
    color: var(--vw-red);
}

/* ============================================
   Chart Containers
   ============================================ */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: var(--vw-white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.chart-container.large {
    grid-column: span 2;
}

.chart-container.medium {
    grid-column: span 1;
}

.chart-container.full {
    grid-column: 1 / -1;
}

.chart-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--vw-gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--vw-gray-light) 0%, var(--vw-white) 100%);
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--vw-blue-dark);
}

.chart-actions {
    display: flex;
    gap: 5px;
}

.chart-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--vw-gray);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-btn:hover {
    background: var(--vw-blue);
    color: var(--vw-white);
}

.chart-body {
    padding: 25px;
    min-height: 400px;
    position: relative;
}

.chart-container.medium .chart-body {
    min-height: 350px;
}

/* ============================================
   Qlik Object Placeholder
   ============================================ */
.qlik-object-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 350px;
    color: var(--vw-gray);
    text-align: center;
    border: 2px dashed var(--vw-gray-light);
    border-radius: 8px;
    background: var(--vw-gray-light);
}

.qlik-object-placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--vw-blue);
    opacity: 0.5;
}

.qlik-object-placeholder p {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--vw-gray-dark);
}

.qlik-object-placeholder small {
    font-size: 12px;
    color: var(--vw-gray);
}

/* ============================================
   Qlik Iframe
   ============================================ */
.qlik-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
    background: var(--vw-white);
}

.chart-body.loading {
    position: relative;
}

.chart-body.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid var(--vw-gray-light);
    border-top-color: var(--vw-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10;
}

/* ============================================
   Qlik Object Error
   ============================================ */
.qlik-object-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--vw-red);
    background: #fff5f5;
    border: 2px dashed var(--vw-red);
    border-radius: 8px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qlik-object-error i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.qlik-object-error p {
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 16px;
}

.qlik-object-error small {
    color: var(--vw-gray);
    margin-bottom: 15px;
}

.qlik-object-error button {
    padding: 8px 16px;
    background: var(--vw-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.qlik-object-error button:hover {
    background: var(--vw-blue-dark);
}

/* ============================================
   Configuration Error
   ============================================ */
.configuration-error {
    color: var(--vw-orange);
    font-size: 14px;
    margin-top: 10px;
    padding: 15px;
    background: #fff8e1;
    border: 2px dashed var(--vw-orange);
    border-radius: 8px;
    text-align: center;
}

.configuration-error strong {
    display: block;
    margin-bottom: 10px;
}

.configuration-error code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1200px) {
    .chart-container.large {
        grid-column: span 1;
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .topbar-title h1 {
        font-size: 20px;
    }

    .kpi-row {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-container.large,
    .chart-container.medium,
    .chart-container.full {
        grid-column: span 1;
    }

    .page-content {
        padding: 20px;
    }

    .page-header h2 {
        font-size: 24px;
    }
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--vw-gray-light);
    border-top-color: var(--vw-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Utilities
   ============================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

