/* Base Styles */
* {
    font-family: 'Inter', sans-serif;
}

/* Sidebar Styles */
.sidebar {
    position: relative;
    z-index: 50;
    width: 15rem; /* w-60 = 240px - normal width */
}

.sidebar.collapsed {
    width: 4.5rem; /* 72px - collapsed width */
}

.sidebar.collapsed .sidebar-text {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

.sidebar.collapsed .submenu-arrow {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-group button {
    justify-content: center;
}

/* Hover effect untuk membuka sidebar saat collapsed */
.sidebar.collapsed:hover {
    width: 15rem !important; /* w-60 = 240px */
    z-index: 60;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
}

.sidebar.collapsed:hover .sidebar-text {
    display: inline !important;
}

.sidebar.collapsed:hover .submenu.hidden {
    display: none !important;
}

.sidebar.collapsed:hover .submenu.open {
    display: block !important;
}

.sidebar.collapsed:hover .submenu-arrow {
    display: block !important;
}

.sidebar.collapsed:hover .nav-item {
    justify-content: flex-start !important;
    padding: 0.625rem 0.875rem !important;
}

.sidebar.collapsed:hover .nav-group button {
    justify-content: space-between !important;
}

/* Navigation Items */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    color: #94a3b8;
    transition: all 0.2s;
    gap: 0.625rem;
    font-size: 0.875rem;
}

.nav-item:hover {
    background-color: #334155;
    color: white;
}

.nav-item.active {
    background-color: #3b82f6;
    color: white;
}

.nav-subitem {
    display: block;
    padding: 0.5rem 0.875rem;
    border-radius: 0.375rem;
    color: #94a3b8;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.nav-subitem:hover {
    background-color: #334155;
    color: white;
}

.nav-subitem.active {
    color: #3b82f6;
    background-color: #1e293b;
}

/* Submenu Animation */
.submenu {
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

/* Submenu default: hidden (tertutup) */
.submenu.hidden {
    display: none !important;
    max-height: 0;
}

.submenu.open {
    display: block !important;
    max-height: 1000px;
}

.submenu-arrow.rotated {
    transform: rotate(180deg);
}

/* Cards */
.stat-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: #f8fafc;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.8125rem;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-gray {
    background-color: #f1f5f9;
    color: #475569;
}

.badge-green {
    background-color: #dcfce7;
    color: #166534;
}

.badge-red {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-yellow {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-purple {
    background-color: #f3e8ff;
    color: #7c3aed;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.8125rem;
    transition: all 0.2s;
    gap: 0.375rem;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-success {
    background-color: #22c55e;
    color: white;
}

.btn-success:hover {
    background-color: #16a34a;
}

.btn-info {
    background-color: #06b6d4;
    color: white;
}

.btn-info:hover {
    background-color: #0891b2;
}
    background-color: #16a34a;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
}

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

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    background-color: white;
    cursor: pointer;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 1rem;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal.open .modal-content {
    transform: scale(1);
}

/* Toast */
.toast {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-left: 4px solid #22c55e;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Spinner */
.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        width: 15rem !important; /* Force normal width on mobile */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.open {
        left: 0 !important;
        z-index: 1000;
    }
    
    /* Disable collapsed state on mobile */
    .sidebar.collapsed {
        width: 15rem !important;
    }
    
    .sidebar.collapsed .sidebar-text {
        display: inline !important;
    }
    
    .sidebar.collapsed .submenu {
        display: block !important;
    }
    
    .sidebar.collapsed .submenu-arrow {
        display: block !important;
    }
    
    /* Ensure overlay is below sidebar */
    #sidebar-overlay {
        z-index: 999 !important;
    }
    
    /* Ensure main content is below sidebar */
    #main-content {
        position: relative;
        z-index: 1 !important;
    }
    
    /* Ensure map container is below sidebar */
    #customers-map-container {
        position: relative;
        z-index: 1 !important;
    }
    
    /* Ensure Leaflet map is below sidebar - all panes and controls */
    #customers-map-container .leaflet-container,
    #customers-map-container .leaflet-control-container,
    #customers-map-container .leaflet-pane,
    #customers-map-container .leaflet-map-pane,
    #customers-map-container .leaflet-tile-pane,
    #customers-map-container .leaflet-overlay-pane,
    #customers-map-container .leaflet-shadow-pane,
    #customers-map-container .leaflet-marker-pane,
    #customers-map-container .leaflet-tooltip-pane,
    #customers-map-container .leaflet-popup-pane,
    #customers-map-container .leaflet-top,
    #customers-map-container .leaflet-bottom,
    #customers-map-container .leaflet-left,
    #customers-map-container .leaflet-right,
    #customers-map-container .leaflet-popup,
    #customers-map-container .leaflet-tooltip {
        position: relative !important;
        z-index: 1 !important;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Power Level Colors */
.power-good {
    color: #16a34a;
}

.power-warning {
    color: #d97706;
}

.power-critical {
    color: #dc2626;
}

/* Animated Line for ODP to Customer Connection */
@keyframes dashMove {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 30;
    }
}

/* Mobile Map Container Fix */
@media (max-width: 1024px) {
    /* Ensure main content and map are below sidebar */
    #main-content {
        position: relative;
        z-index: 1;
    }
    
    #customers-map-container {
        height: calc(100vh - 180px) !important;
        margin-top: 0.5rem;
        position: relative;
        z-index: 1;
    }
    
    /* Ensure Leaflet map controls are below sidebar */
    #customers-map-container .leaflet-container {
        position: relative;
        z-index: 1;
    }
    
    /* When sidebar is open, ensure content doesn't overlap */
    .sidebar.open ~ * #main-content,
    .sidebar.open ~ * #customers-map-container {
        z-index: 1;
    }
}
