/* ===================================
   GLASSMORPHISM DASHBOARD STYLES
   =================================== */

:root {
    /* Glass Effect Colors */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    
    /* Accent Colors - Bright with transparency */
    --primary: rgba(59, 130, 246, 0.8);
    --primary-hover: rgba(59, 130, 246, 1);
    --success: rgba(16, 185, 129, 0.8);
    --success-hover: rgba(16, 185, 129, 1);
    --danger: rgba(239, 68, 68, 0.8);
    --danger-hover: rgba(239, 68, 68, 1);
    --warning: rgba(245, 158, 11, 0.8);
    --warning-hover: rgba(245, 158, 11, 1);
    --info: rgba(6, 182, 212, 0.8);
    --info-hover: rgba(6, 182, 212, 1);
    
    /* Background */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.05);
    
    /* Text Colors - Enhanced brightness */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.98);
    --text-muted: rgba(255, 255, 255, 0.85);
    --text-label: rgba(255, 255, 255, 0.95);
    --text-heading: #ffffff;
    
    /* Dimensions */
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;
    --header-height: 70px;
    --footer-height: 50px;
    
    /* Transitions */
    --transition-speed: 0.3s;
    
    /* Z-index - From bottom to top */
    --z-content: 1;
    --z-header: 80;
    --z-footer: 80;
    --z-sidebar: 90;
    --z-overlay: 95;
    --z-modal: 100;
    --z-alert: 110;
}

/* ===================================
   BASE RESET
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    /* background: var(--bg-gradient); */
    background-image: url('/assets/bg/sawah-bg-1.webp');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Darken background image */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.1) 100%), rgba(0, 0, 0, 0.8); */
    pointer-events: none;
    z-index: 0;
}

/* Overlay untuk meningkatkan kontras glass effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%); */
    pointer-events: none;
    z-index: 0;
}

#app-container {
    position: relative;
    z-index: 1;
}

/* ===================================
   TYPOGRAPHY - Enhanced Brightness
   =================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 600;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 2rem;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.1);
    font-weight: 700;
}

h2 {
    font-size: 1.5rem;
    color: #ffffff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

h3 {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.98);
    font-weight: 600;
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

label {
    color: var(--text-label);
    font-weight: 500;
    font-size: 0.9375rem;
}

/* ===================================
   GLASS EFFECT MIXIN
   =================================== */
.glass {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.glass-hover {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}

.glass-hover::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform 0.6s ease;
}

.glass-hover:hover::before {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

.glass-hover:hover {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.25);
}

/* ===================================
   LAYOUT STRUCTURE
   =================================== */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ===================================
   HEADER
   =================================== */
.app-header {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    height: var(--header-height);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    transition: left var(--transition-speed) ease;
}

.app-header.sidebar-open {
    left: var(--sidebar-width);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: 60px; /* Make space for hamburger button */
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Hamburger Menu Button - Floating Open Button */
.hamburger-open {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-right: 1rem;
    position: fixed;
    left: 1rem;
    top: 15px;
    z-index: calc(var(--z-header) + 1);
    opacity: 0;
    visibility: hidden;
}

.hamburger-open.visible {
    opacity: 1;
    visibility: visible;
}

.hamburger-open:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.hamburger-open span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Sidebar Close Button */
.sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 1.25rem;
}

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

.app-logo {
    display: flex;
    align-items: center; /* Vertically center logo and title */
    gap: 1rem;
}

.logo-img {
    height: 45px; /* Slightly taller than previous icon */
    width: auto; /* Maintain aspect ratio */
    object-fit: contain;
    flex-shrink: 0; /* Prevent logo from shrinking */
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0; /* Prevent logo from shrinking */
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 1.2; /* Improve vertical centering */
    margin: 0; /* Remove any default margin */
    display: flex;
    align-items: center; /* Center text within its own height */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===================================
   SIDEBAR
   =================================== */
.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding-top: var(--header-height);
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease;
    z-index: var(--z-sidebar);
    overflow-y: auto;
}

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

.app-sidebar.closed {
    transform: translateX(-100%);
}

.sidebar-nav {
    padding: 1.5rem 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s;
}

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

.nav-item.active {
    background: var(--primary);
    color: white;
}

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

.nav-text {
    font-size: 0.9375rem;
    font-weight: 500;
}

/* ===================================
   MAIN CONTENT
   =================================== */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: row; /* Explicit row direction for two-column layout */
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    margin-left: 0;
    transition: margin-left var(--transition-speed) ease;
    overflow: hidden;
    height: calc(100vh - var(--header-height) - var(--footer-height));
    width: 100%;
}

.app-main.sidebar-open {
    margin-left: var(--sidebar-width);
}

/* ===================================
   CONTENT PANELS
   =================================== */
.content-wrapper {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.content-single {
    width: 100%;
}

.content-left {
    flex: 1 1 auto; /* Grow, shrink, auto basis */
    min-width: 300px; /* Minimum width to prevent collapsing */
    position: relative;
    height: 100%;
    overflow: hidden;
    z-index: 1; /* Below sidebar to prevent covering */
}

.content-right {
    flex: 0 0 400px; /* Don't grow, don't shrink, fixed 400px */
    width: 400px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    position: relative;
}

/* Panels inside content-right should have natural spacing */
.content-right > .panel {
    margin-bottom: 1.5rem;
}

.content-right > .panel:last-child {
    margin-bottom: 0;
}

.content-right::-webkit-scrollbar {
    width: 8px;
}

.content-right::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.content-right::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.content-right::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Map Container */
.map-wrapper {
    height: 100%;
    width: 100%;
    position: relative;
}

.map-container {
    height: 100%;
    width: 100%;
    border-radius: 0 0 16px 16px;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1; /* Below sidebar (z-index: 90) */
}

.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* Map Floating Panels */
.map-floating-panel {
    transition: all 0.3s ease;
}

.map-floating-panel .panel-header {
    user-select: none;
}

.map-floating-panel .panel-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.875rem;
}

.map-floating-panel .panel-collapsible {
    transition: all 0.3s ease;
    overflow: hidden;
}

.map-floating-panel.collapsed .panel-toggle-icon {
    transform: rotate(0deg);
}

.map-floating-panel:not(.collapsed) .panel-toggle-icon {
    transform: rotate(180deg);
}

/* ===================================
   CARDS & PANELS
   =================================== */
.panel {
    border-radius: 16px;
    padding: 1.5rem;
    height: auto; /* Allow panels to grow with content */
}

/* Panel untuk Grid Layout (halaman Layers, Upload, Export, dll) */
.panel-grid {
    display: flex;
    flex-direction: column;
    min-height: 100%; /* Ensure all panels in grid have same height */
}

.panel-grid .panel-body {
    flex: 1; /* Push actions to bottom */
}

.panel-grid .panel-actions,
.panel-grid > div:last-child {
    margin-top: auto; /* Align buttons to bottom */
}

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

.panel-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.panel-body {
    color: var(--text-secondary);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stat-card {
    border-radius: 12px;
    padding: 1rem;
    min-height: 100px; /* Ensure minimum height for visibility */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.3;
}

/* ===================================
   BUTTONS - GLASSMORPHISM COMPLETE
   =================================== */
.btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 70%
    );
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform 0.6s ease;
}

.btn:hover::before {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Button Variants */
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: var(--success-hover);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger-hover);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: var(--warning);
    color: white;
    border-color: rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: var(--warning-hover);
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

.btn-info {
    background: var(--info);
    color: white;
    border-color: rgba(6, 182, 212, 0.3);
}

.btn-info:hover {
    background: var(--info-hover);
    border-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.4);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-icon {
    padding: 0.625rem;
    width: 40px;
    height: 40px;
    justify-content: center;
}

.btn-icon i,
.btn-icon .fa,
.btn-icon .fas,
.btn-icon .far,
.btn-icon .fab {
    color: #ffffff !important;
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1.0625rem;
}

/* Button Group */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-group .btn {
    margin: 0;
}

/* Disabled State */
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===================================
   FORM ELEMENTS - GLASSMORPHISM
   =================================== */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="color"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px) saturate(180%);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--transition-speed) ease;
    outline: none;
}

.input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="color"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Select dropdown styling */
select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

select option {
    background: rgba(20, 20, 40, 0.95);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Checkbox & Radio styling */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

/* Range slider */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    padding: 0;
    border: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* File upload button */
input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 1rem;
    transition: all var(--transition-speed) ease;
}

input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
}

/* Disabled state */
.input:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.03);
}

/* ===================================
   FOOTER
   =================================== */
.app-footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-footer);
    transition: left var(--transition-speed) ease;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.app-footer.sidebar-open {
    left: var(--sidebar-width);
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-logo {
    height: 32px; /* Appropriate size for footer */
    width: auto;
    object-fit: contain;
    opacity: 0.9;
}

.footer-text {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ===================================
   OVERLAY
   =================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed) ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

/* Badge Component */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

/* ===================================
   SCROLLBAR STYLING
   =================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===================================
   TABLES - GLASSMORPHISM
   =================================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
}

table tbody td {
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

table tbody td:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
}

.table-actions .btn {
    padding: 0.4rem 0.875rem;
    font-size: 0.8125rem;
}

.table-actions .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0.4rem;
}

/* Action Links */
.action-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.action-link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-hover);
}

.action-link.danger {
    color: var(--danger);
}

.action-link.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-hover);
}

.action-link.success {
    color: var(--success);
}

.action-link.success:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-hover);
}

.action-link.warning {
    color: var(--warning);
}

.action-link.warning:hover {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-hover);
}

/* ===================================
   LEAFLET CUSTOMIZATION
   =================================== */

/* Leaflet Zoom Controls - Glassmorphism Style */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
}

.leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-zoom-in {
    border-radius: 12px 12px 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 12px 12px !important;
}

/* Leaflet Attribution - Glassmorphism Style */
.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    margin: 0 8px 8px 0 !important;
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

.leaflet-control-attribution a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
}

.leaflet-control-attribution a:hover {
    color: #ffffff !important;
    text-decoration: underline !important;
}

/* Leaflet Popup - Glassmorphism Style */
.leaflet-popup-content-wrapper {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(8px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(8px) saturate(180%) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    color: #ffffff !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    color: #ffffff !important;
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

.leaflet-popup-close-button {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 18px !important;
    font-weight: bold !important;
    padding: 4px 8px !important;
    transition: all 0.2s ease !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    top: 8px !important;
    right: 8px !important;
}

.leaflet-popup-close-button:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
}

.leaflet-popup-close-button span {
    display: block !important;
    line-height: 1 !important;
}

/* Popup Title Styling */
.leaflet-popup-content h3 {
    color: rgba(255, 255, 255, 0.95) !important;
}

.leaflet-popup-content-wrapper h3 {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Leaflet Layer Control - Glassmorphism Style */
.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    color: #ffffff !important;
}

.leaflet-control-layers-expanded {
    padding: 12px !important;
}

.leaflet-control-layers-toggle {
    background-image: none !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.leaflet-control-layers-toggle::before {
    content: '\f5fd';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #ffffff;
    font-size: 16px;
}

.leaflet-control-layers label {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500 !important;
    padding: 6px 0 !important;
}

.leaflet-control-layers-separator {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Leaflet Draw Controls - Glassmorphism Style */
.leaflet-draw {
    position: relative !important;
}

.leaflet-draw-toolbar {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-draw-toolbar a {
    background: transparent !important;
    border: none !important;
    transition: all 0.2s ease !important;
}

.leaflet-draw-toolbar a:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Leaflet TimeDimension Control - Glassmorphism Style */
.leaflet-control-timecontrol {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    padding: 10px !important;
}

.timecontrol-date {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    padding: 6px 12px !important;
    font-weight: 600 !important;
}

.timecontrol-slider {
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
}

.timecontrol-slider input[type="range"] {
    background: transparent !important;
}

.timecontrol-slider input[type="range"]::-webkit-slider-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.timecontrol-slider input[type="range"]::-moz-range-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* ===================================
   ECHARTS CUSTOMIZATION
   =================================== */

/* Chart Container */
.chart-container {
    background: transparent;
    border-radius: 12px;
    position: relative;
}

/* Loading Indicator for Charts */
.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

/* Chart Tooltip Custom Style */
.echarts-tooltip {
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}