/* style-map.css - Map, Leaflet themes, popups, markers, device icons, quick help */
/* Map */
#map { width: 100%; height: 100%; position: relative; z-index: 1; }

/* Context Menu Map-Only Hide logic */
.leaflet-contextmenu.contextmenu-on-marker .map-only-menu-item {
    display: none !important;
}

/* Draggable Marker Styles */
.leaflet-marker-dragging {
    cursor: move !important;
    opacity: 0.8;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.leaflet-marker-draggable {
    cursor: grab !important;
    transition: all 0.2s ease;
}

.leaflet-marker-draggable:hover {
    cursor: grabbing !important;
    transform: scale(1.1);
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
}

/* Active Draggable Marker dengan Glowing Effect */
.leaflet-marker-drag-active {
    animation: markerGlow 2s ease-in-out infinite alternate;
    cursor: grab !important;
    position: relative;
    z-index: 1000 !important;
}

.leaflet-marker-drag-active img {
    border: 3px solid #007bff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
}

.leaflet-marker-drag-active:hover {
    cursor: grabbing !important;
    transform: scale(1.2);
    filter: drop-shadow(0 8px 16px rgba(0, 123, 255, 0.8));
}

.leaflet-marker-drag-active:hover img {
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
}

@keyframes markerGlow {
    0% {
        filter: drop-shadow(0 0 8px rgba(0, 123, 255, 0.6))
                drop-shadow(0 0 16px rgba(0, 123, 255, 0.4))
                drop-shadow(0 0 24px rgba(0, 123, 255, 0.3))
                drop-shadow(0 0 32px rgba(0, 123, 255, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(0, 123, 255, 0.8))
                drop-shadow(0 0 24px rgba(0, 123, 255, 0.6))
                drop-shadow(0 0 36px rgba(0, 123, 255, 0.4))
                drop-shadow(0 0 48px rgba(0, 123, 255, 0.3));
    }
    100% {
        filter: drop-shadow(0 0 16px rgba(0, 123, 255, 1))
                drop-shadow(0 0 32px rgba(0, 123, 255, 0.8))
                drop-shadow(0 0 48px rgba(0, 123, 255, 0.6))
                drop-shadow(0 0 64px rgba(0, 123, 255, 0.4));
    }
}

/* Visual indicator for draggable markers */
.leaflet-marker-draggable::after {
    content: '⋮⋮';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffc107;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.leaflet-marker-draggable:hover::after {
    opacity: 1;
}

/* Enhanced indicator for active draggable marker */
.leaflet-marker-drag-active::after {
    content: '⋮⋮';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    color: #007bff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 123, 255, 0.8),
                 0 0 16px rgba(0, 123, 255, 0.6);
    pointer-events: none;
    opacity: 1;
    animation: indicatorPulse 1.5s ease-in-out infinite;
    z-index: 1001 !important;
}

@keyframes indicatorPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
        text-shadow: 0 0 8px rgba(0, 123, 255, 0.8),
                     0 0 16px rgba(0, 123, 255, 0.6);
    }
    50% {
        transform: translateX(-50%) scale(1.3);
        opacity: 0.8;
        text-shadow: 0 0 12px rgba(0, 123, 255, 1),
                     0 0 24px rgba(0, 123, 255, 0.8);
    }
}

/* Confirmation dialog styling */
.marker-drag-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    max-width: 400px;
}

.marker-drag-confirm h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.marker-drag-confirm .coordinates {
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

.marker-drag-confirm .buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

.marker-drag-confirm button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.marker-drag-confirm .btn-confirm {
    background: #28a745;
    color: white;
}

.marker-drag-confirm .btn-cancel {
    background: #dc3545;
    color: white;
}

.marker-drag-confirm button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Leaflet Context Menu Dark Theme */
.leaflet-contextmenu {
  background: #1a2530 !important;
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  padding: 2px 0 !important; /* Extra compact padding */
  min-width: 150px !important;
  backdrop-filter: blur(10px) !important;
}

.leaflet-contextmenu-item {
  color: #ecf0f1 !important;
  padding: 4px 10px !important; /* Reduced vertical & horizontal padding */
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
  font-size: 12px !important; /* Smaller font */
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  border-top: 1px solid transparent !important;
  border-bottom: 1px solid transparent !important;
  transition: all 0.1s ease !important;
}

.leaflet-contextmenu-item.over {
  background-color: rgba(52, 152, 219, 0.2) !important;
  color: #ffffff !important;
  border-top: 1px solid rgba(52, 152, 219, 0.1) !important;
  border-bottom: 1px solid rgba(52, 152, 219, 0.1) !important;
  padding-left: 12px !important; /* Reduced slide effect */
}

.leaflet-contextmenu-separator {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin: 2px 0 !important; /* Compact margin */
}

/* Icons in context menu */
.leaflet-contextmenu-icon {
  width: 14px !important; /* Smaller icons */
  height: 14px !important;
  margin: 0 !important;
  filter: brightness(0) invert(1) !important;
  opacity: 0.7 !important;
}

.leaflet-contextmenu-item.over .leaflet-contextmenu-icon {
  opacity: 1 !important;
}

/* Custom styles for specific menu text with colors */
.leaflet-contextmenu-item span {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Fix for emojis not needing inversion */
.leaflet-contextmenu-item {
  /* Emojis should keep their colors */
  text-shadow: 0 0 0 transparent !important;
}

/* Map Filter Panel Dark Theme */
.filter-content {
  max-height: 85vh;
  overflow-y: auto;
  /* Hide scrollbar while allowing scrolling */
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.filter-content::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.filter-content select, .filter-content input {
  transition: all 0.2s ease;
}

.filter-content select:focus, .filter-content input:focus {
  outline: none;
  border-color: #3498db !important;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2) !important;
}


/* Request Marker Popup Styles */
.request-popup .leaflet-popup-content {
    margin: 12px 16px;
    line-height: 1.4;
    font-size: 12px;
    font-family: Arial, sans-serif;
    max-height: 320px;
    overflow-y: auto;
}

.request-popup-content {
    min-width: 280px;
    max-width: 350px;
}

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e8ed;
}

.request-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

.request-info {
    margin-bottom: 12px;
}

.request-actions {
    text-align: center;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #dee2e6;
}

/* Vertical button layout */
.request-actions .btn {
    font-size: 11px;
    padding: 6px 12px;
    margin: 2px 0;
    display: block;
    width: 100%;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.request-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.request-actions .btn-success {
    background: #28a745;
    color: white;
}

.request-actions .btn-danger {
    background: #dc3545;
    color: white;
}

.request-actions .btn-info {
    background: #17a2b8;
    color: white;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-badge.status-pending {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #d63031;
}

.status-badge.status-approved {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
}

.status-badge.status-rejected {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    color: white;
}

.status-badge.status-completed {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
}

/* Request approval animations */
.requests-table tr {
    transition: all 0.3s ease;
}

.requests-table tr.approval-success {
    background-color: rgba(46, 204, 113, 0.2) !important;
    border-left: 4px solid #2ecc71 !important;
    transform: scale(1.02);
}

.requests-table tr.approval-processing {
    background-color: rgba(243, 156, 18, 0.2) !important;
    border-left: 4px solid #f39c12 !important;
}

.requests-table tr.approval-error {
    background-color: rgba(231, 76, 60, 0.2) !important;
    border-left: 4px solid #e74c3c !important;
    animation: shake 0.5s ease-in-out;
}

/* Button loading states */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn.loading.btn-success::after {
    border-color: #ffffff;
    border-top-color: transparent;
}

.btn.loading.btn-danger::after {
    border-color: #ffffff;
    border-top-color: transparent;
}

/* Status badge transitions */
.status-badge {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.status-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s;
}

.status-badge.status-updating::before {
    left: 100%;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    transition: all 0.2s ease;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Spin animation for loading */
@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.request-info {
    margin-bottom: 12px;
}

.request-info p {
    margin: 4px 0;
    font-size: 0.9rem;
    color: #495057;
}

.request-info strong {
    color: #2c3e50;
    font-weight: 600;
}

.request-details {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    border-left: 3px solid #3498db;
}

.request-details h5 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
}

.request-details p {
    margin: 3px 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.request-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #dee2e6;
    justify-content: center;
}

.request-actions .btn {
    flex: 0 1 auto;
    min-width: 80px;
    padding: 6px 12px;
    font-size: 0.7rem;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.request-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.request-actions .btn-success {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
}

.request-actions .btn-danger {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    color: white;
}

.request-actions .btn-info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

/* Enhanced Map Controls */
.map-controls {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    min-width: 200px;
}

.map-controls label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    display: block;
}

.map-controls select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-controls select:focus {
    outline: none;
    border-color: #3498db;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.map-controls select:hover {
    border-color: #74b9ff;
}

/* Request Type Icons in Select Options */
.map-controls option {
    padding: 8px;
}

/* Leaflet Popup Enhancements */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: none;
}

.leaflet-popup-tip {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Mobile responsiveness for popups */
@media (max-width: 768px) {
    .request-popup-content {
        min-width: 250px;
        max-width: 300px;
    }
    
    .request-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .request-actions {
        flex-direction: column;
    }
    
    .request-actions .btn {
        width: 100%;
        flex: none;
    }
    
    .map-controls {
        padding: 12px;
        min-width: 180px;
    }
}

/* Animation for request markers */
@keyframes requestMarkerPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.request-marker-pending {
    animation: requestMarkerPulse 2s infinite;
}

/* Enhanced marker tooltips */
.marker-tooltip {
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    padding: 2px 2px;
    border: #ffffff90 solid 1px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 500ms ease-in-out;
}

.device-link {
    transition: stroke-opacity 300ms ease-in-out;
}

.map-connection-line {
    stroke-dasharray: 10, 10;
    animation: flowAnimation 1s linear infinite;
}

@keyframes flowAnimation {
    from {
        stroke-dashoffset: 20;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.quick-map-filters {
    background: #2c3e50 !important;
    color: #ecf0f1;
    border-left-color: #3498db !important;
}
.quick-map-filters h4 {
    color: #ecf0f1 !important;
}
.quick-map-filters div {
    color: #ecf0f1 !important;
}

#filter-content {
    background: #2c3e50 !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

#filter-content h4 {
    color: #ecf0f1 !important;
}

#filter-content label {
    color: #ecf0f1 !important;
}

#filter-content #filter-close {
    color: #ecf0f1 !important;
}

#filter-content .filter-stats {
    background: #34495e !important;
    color: #ecf0f1 !important;
}

/* Enhanced Modal Styles for Requests */
.request-modal-content {
  max-width: 700px;
  width: 95%;
  max-height: calc(80vh - 40px);
  overflow-y: auto;
  background-color: #1a2530; 
  color: #ecf0f1;
  border-radius: 12px; 
  padding: 24px;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.request-detail-section {
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border-left: 4px solid #3498db;
}

.request-detail-title {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.request-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  color: #ffffff;
  font-weight: 500;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Notification Styles */
.notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Allow clicks through container */
}

.notification {
    position: relative; /* Changed from fixed to relative for stacking */
    width: auto;
    min-width: 300px;
    max-width: 90vw;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    line-height: 1.4;
    pointer-events: auto; /* Re-enable clicks for the notification itself */
    animation: notificationSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.notification-content span {
    flex: 1;
    word-break: break-word;
}

@media (max-width: 768px) {
    .notification-container {
        top: 15px;
        width: 95vw;
    }
    .notification {
        width: 100%;
        min-width: unset;
        padding: 12px 16px;
        font-size: 0.85rem;
    }
}

.notification-success {
    background-color: rgba(40, 167, 69, 0.95);
}

.notification-error {
    background-color: rgba(220, 53, 69, 0.95);
}

.notification-info {
    background-color: rgba(23, 162, 184, 0.95);
}

.notification-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: white;
    font-size: 1.4rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 10px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    flex-shrink: 0;
}

.notification-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.2);
}

.notification-hiding {
    opacity: 0;
    transform: translateY(-30px) scale(0.9) !important;
}

/* ===================== Device Icons & Markers ===================== */

/* Device icon styling */
.device-icon {
    transition: all 0.2s ease;
}

.device-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
}

/* Emoji font fallbacks for device icons */
.device-icon text,
.legend-icon text {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', 'Android Emoji', 'EmojiSymbols', sans-serif;
    font-size: inherit;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Device popup styling */
.device-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-width: 280px;
    max-width: 350px;
    transition: opacity 0.2s ease;
    color: #ecf0f1;
}

.device-popup.popup-refreshing {
    opacity: 0.55;
}

.device-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.device-type-badge {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-details {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -4px; /* Slight offset for scrollbar space */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Custom scrollbar for dark popups */
.device-details::-webkit-scrollbar {
    width: 6px;
}

.device-details::-webkit-scrollbar-track {
    background: transparent;
}

.device-details::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.device-details::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.device-details > div {
    margin-bottom: 4px;
    padding: 2px 0;
}

.diagnosis-row {
    word-break: normal;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.diagnosis-row strong {
    color: #ffc107;
}

/* Live Ping Panel Animation */
.live-ping-panel {
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    opacity: 0;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border: 0 solid transparent;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.live-ping-panel.active {
    max-height: 200px; /* Large enough to fit content */
    opacity: 1;
    margin-bottom: 8px !important;
    padding: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.live-dot {
    height: 8px;
    width: 8px;
    background-color: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    box-shadow: 0 0 5px #2ecc71;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes aiPulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.ai-loading {
    animation: aiPulse 1.5s infinite;
    color: #bdc3c7;
    font-style: italic;
}

.status-indicator {
    font-weight: 500;
}

.status-indicator.status-up {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-indicator.status-down {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.active-requests {
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0% { background-color: rgba(243, 156, 18, 0.2); }
    50% { background-color: rgba(243, 156, 18, 0.4); }
    100% { background-color: rgba(243, 156, 18, 0.2); }
}

/* Request popup styling */
.request-popup-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.request-header {
    background: rgba(255, 255, 255, 0.05);
    margin: -10px -10px 10px -10px;
    padding: 10px;
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-small {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 20px;
}

.switch-small input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-small {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .3s;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider-small:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.slider-small:after {
  content: 'OFF';
  color: white;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  font-weight: bold;
  opacity: 0.7;
  transition: .3s;
}

input:checked + .slider-small {
  background-color: #2ecc71;
  border-color: #27ae60;
}

input:checked + .slider-small:before {
  transform: translateX(22px);
}

input:checked + .slider-small:after {
  content: 'ON';
  left: 6px;
  right: auto;
  opacity: 1;
}

.status-badge {
    display: inline-block;
    font-weight: 500;
    border-radius: 12px;
}

.status-badge.status-pending {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.status-badge.status-approved {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-badge.status-rejected {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.status-badge.status-completed {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: #1a2530; /* Solid dark matching body */
    border-radius: 12px;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
    color: #ecf0f1;
}

.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Darker overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(3px);
}

.custom-modal-content {
    background: #1a2530; /* Solid dark matching body */
    border-radius: 12px;
    padding: 0;
    max-width: 90%;
    max-height: 70%;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
    color: #ecf0f1;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #ecf0f1;
    z-index: 10001;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.modern-close {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ecf0f1 !important;
}

.modern-close:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

.form-header {
    background: #1a2530; /* Solid dark matching body */
    color: white;
    padding: 24px;
    border-radius: 12px 12px 0 0;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.form-header .form-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.form-header h2 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff; /* Brighter white */
}

.form-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.modern-device-form {
    width: 600px;
    max-width: 90vw;
}

.device-form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 6px;
    font-weight: 500;
    color: #bdc3c7;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    background-color: rgba(255, 255, 255, 0.05);
    color: #ecf0f1;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    background-color: rgba(255, 255, 255, 0.08);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: #ecf0f1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.field-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .modern-device-form {
        width: 95vw;
        margin: 10px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===================== End Device Icons & Markers ===================== */

/* ===================== Quick Help Button in Sidebar ===================== */
.sidebar-quick-help {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.quick-help-btn {
    width: 100%;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.quick-help-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.quick-help-btn i {
    font-size: 16px;
}

.quick-help-container {
    padding: 15px;
    border-top: 1px solid #465b70;
    margin-top: 10px;
}

/* ===================== End Quick Help Button ===================== */
