﻿:root {
    --primary-blue: #5B6FED;
    --primary-purple: #4A5FD9;
    --dark-blue: #3A4ABC;
    --sidebar-bg: #5B6FED;
    --sidebar-active: #4A5FD9;
    --bg-gray: #F5F6FA;
    --card-bg: #FFFFFF;
    --text-dark: #2C3E50;
    --text-light: #6C757D;
    --online-green: #28a745;
    --offline-blue: #3498DB;
    --defect-yellow: #F1C40F;
    --operating-green: #28a745;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

/* === UNIFIED MENU TOGGLE === */
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 2000;
    width: 48px;
    height: 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--primary-blue);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
    text-indent: -9999px;
}

.menu-toggle:hover {
    background: white;
    transform: scale(1.05);
}

.menu-toggle::before {
    content: '\2630';
    position: absolute;
    text-indent: 0;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* === GLOBAL RESET BUTTON === */
.global-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 16px;
    left: 72px;
    z-index: 2000;
    width: 48px;
    height: 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--primary-blue);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
}

.global-reset-btn:hover {
    background: white;
    transform: scale(1.05);
    color: var(--primary-purple);
}

/* === DROPDOWN NAVIGATION === */
.nav-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
}

.nav-dropdown.open {
    transform: translateX(0);
}

.nav-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.logo-compact h1 {
    font-size: 20px;
    font-weight: 700;
}

.close-dropdown {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-dropdown:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(4px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

.nav-link .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* === DESKTOP LAYOUT === */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-purple) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: relative;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 15px;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

.nav-item .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* === VERSION INFO === */
.version-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 20px;
    margin-top: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.version-info span {
    opacity: 0.7;
}

.sidebar.collapsed .version-info {
    display: none;
}

.version-info-mobile {
    text-align: center;
    padding: 16px 20px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* === FULL SCREEN MAP DASHBOARD === */
.dashboard-fullmap {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.fullscreen-map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* === MARKER SIZE SLIDER === */
.marker-size-control {
    position: fixed;
    top: 170px;
    left: 21px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 500;
    box-shadow: var(--glass-shadow);
}

.marker-size-control label {
    font-size: 14px;
    cursor: pointer;
}

.marker-size-control input[type="range"] {
    width: 6px;
    height: 80px;
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    writing-mode: vertical-lr;
    direction: rtl;
    background: linear-gradient(to top, var(--primary-blue), var(--primary-purple));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.marker-size-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.marker-size-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.marker-size-control #markerSizeValue {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
    min-width: 16px;
    text-align: center;
}

/* === FLOATING HEADER === */
.floating-header {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    z-index: 500;
    box-shadow: var(--glass-shadow);
}

.header-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-time {
    font-size: 11px;
    font-weight: 500;
    color: var(--primary-blue);
}

/* === FLOATING STATUS PILLS === */
.floating-status-pills {
    position: fixed;
    top: 80px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 500;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 8px 12px 8px 8px;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.status-pill:hover {
    transform: translateX(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.status-pill canvas {
    border-radius: 50%;
}

.pill-info {
    display: flex;
    flex-direction: column;
}

.pill-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--online-green);
    line-height: 1.2;
}

.pill-label {
    font-size: 10px;
    color: var(--text-light);
    text-transform: uppercase;
}

.pill-expand {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(91, 111, 237, 0.1);
    color: var(--primary-blue);
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.pill-expand:hover {
    background: var(--primary-blue);
    color: white;
}

/* Pill icon styling for Consumo/Economia */
.pill-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 111, 237, 0.1);
    border-radius: 50%;
}

.pill-value-blue {
    color: var(--primary-blue) !important;
}

.pill-value-green {
    color: var(--online-green) !important;
}

/* === FLOATING PANELS (GLASSMORPHISM) === */
.floating-panel {
    position: fixed;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    z-index: 500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.floating-panel.minimized {
    height: auto !important;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(91, 111, 237, 0.1);
    border-bottom: 1px solid rgba(91, 111, 237, 0.1);
    cursor: move;
    user-select: none;
}

.panel-header:active {
    cursor: grabbing;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    pointer-events: none;
}

.panel-close, .panel-toggle {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(91, 111, 237, 0.15);
    color: var(--primary-blue);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.panel-close:hover, .panel-toggle:hover {
    background: var(--primary-blue);
    color: white;
}

.panel-content {
    padding: 16px;
    overflow: hidden;
}

/* Panel Positions */
.panel-top-right {
    top: 80px;
    right: 180px;
    width: 280px;
}

.panel-top-right-2 {
    top: 160px;
    right: 180px;
    width: 280px;
}

.panel-right-3 {
    top: 80px;
    right: 180px;
    width: 320px;
    max-height: 350px;
}

.panel-right-4 {
    top: 80px;
    right: 180px;
    width: 280px;
    max-height: 400px;
}

.panel-bottom-left {
    bottom: 20px;
    left: 80px;
    width: 320px;
    max-height: 300px;
}

.panel-bottom-right {
    bottom: 20px;
    right: 16px;
    width: 280px;
    max-height: 400px;
}

/* Panel Animation */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-animate-in {
    animation: slideIn 0.3s ease;
}

/* === CHART STYLING === */
.chart-container-float {
    position: relative;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-tabs, .economy-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chart-tab, .economy-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: rgba(91, 111, 237, 0.1);
    color: var(--text-dark);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.chart-tab:hover, .economy-tab:hover {
    background: rgba(91, 111, 237, 0.2);
}

.chart-tab.active, .economy-tab.active {
    background: var(--primary-blue);
    color: white;
}

.chart-wrapper {
    height: 180px;
    padding-bottom: 10px;
}

.daily-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    text-align: center;
    margin-bottom: 8px;
}

/* === ECONOMY PANEL === */
.economy-panel {
    overflow-y: auto;
}

.economy-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(91, 111, 237, 0.05);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.metric-row:hover {
    background: rgba(91, 111, 237, 0.1);
    transform: translateX(4px);
}

.metric-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.metric-label {
    font-size: 10px;
    color: var(--text-light);
    text-transform: uppercase;
}

/* === LEGEND === */
.legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-light);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.offline { background: var(--offline-blue); }
.dot.online { background: var(--online-green); }
.dot.defect { background: var(--defect-yellow); }
.dot.operating { background: var(--operating-green); }

/* === MAP TYPE TOGGLE === */
.map-type-toggle {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 4px;
    z-index: 500;
    box-shadow: var(--glass-shadow);
}

.map-type-btn {
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-dark);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.map-type-btn:hover {
    background: rgba(91, 111, 237, 0.1);
}

.map-type-btn.active {
    background: var(--primary-blue);
    color: white;
}

/* === FULLSCREEN MODE === */
.fullscreen-mode .desktop-only { display: none !important; }
.fullscreen-mode .main-content { 
    margin: 0; 
    padding: 0; 
    width: 100vw; 
    min-height: 100vh;
    overflow: hidden;
}
.fullscreen-mode .page-content { 
    margin: 0; 
    padding: 0; 
    min-height: 100vh;
    overflow: hidden;
}

/* === SCROLLABLE PAGES (configuracoes, registros, etc.) === */
.fullscreen-mode .main-content.scrollable-page,
.fullscreen-mode.scrollable-page .main-content { 
    overflow-y: auto;
}
.fullscreen-mode .page-content.scrollable-page,
.fullscreen-mode.scrollable-page .page-content { 
    overflow-y: auto;
    padding-bottom: 40px;
}

/* Override html/body overflow for scrollable pages */
html.scrollable-page,
body.scrollable-page {
    overflow-y: auto !important;
    height: auto !important;
}
body.scrollable-page .app-container {
    overflow-y: auto !important;
    min-height: 100vh;
    height: auto;
}
body.scrollable-page .main-content {
    overflow-y: visible !important;
    height: auto !important;
}
body.scrollable-page .page-content {
    overflow-y: visible !important;
    height: auto !important;
    min-height: auto;
    padding: 20px !important;
    padding-top: 80px !important;
}
.fullscreen-mode .menu-toggle { display: flex !important; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .floating-header { left: 70px; right: 70px; }
    .panel-bottom-left { left: 16px; width: 280px; }
    .panel-bottom-right { width: 240px; }
}

@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .desktop-only { display: none !important; }
    .floating-header { left: 70px; right: 16px; height: 42px; padding: 0 16px; }
    .header-title { font-size: 14px; }
    .floating-status-pills { top: 70px; right: 8px; }
    .status-pill { padding: 6px 10px 6px 6px; }
    .panel-bottom-left, .panel-bottom-right { left: 8px; right: 8px; width: auto; max-width: calc(50% - 12px); }
    .panel-bottom-left { right: auto; }
    .panel-bottom-right { left: auto; }
    .panel-top-right, .panel-top-right-2 { right: 8px; width: 260px; }
}

@media (max-width: 480px) {
    .floating-header { display: none; }
    .floating-status-pills { top: 70px; flex-direction: row; right: 8px; left: 70px; }
    .status-pill { flex: 1; justify-content: center; }
    .panel-bottom-left, .panel-bottom-right { left: 8px; right: 8px; max-width: none; width: auto; }
    .panel-bottom-left { bottom: 80px; }
    .panel-bottom-right { display: none; }
}

/* Leaflet controls positioning */
.leaflet-top.leaflet-left { top: 80px; left: 11px; }
.leaflet-bottom.leaflet-right { bottom: 80px; }

/* Hide page content wrapper styles */
.page-content { padding: 0 !important; margin: 0 !important; }
