/* style-components.css - Modal, forms, buttons, dropdown, badges, alerts, utilities, login */
/* Modal Custom Styles */
.custom-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-modal-content {
  background: #1a2530; /* Solid dark background matching body */
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  padding: 0;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalFadeIn 0.3s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ecf0f1;

  /* Scrollbar styling - hidden by default */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.custom-modal-content .modal-title {
  color: #ffffff; /* Brighter white for better contrast */
}

.custom-modal-content:hover,
.custom-modal-content.is-scrolling {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.custom-modal-content::-webkit-scrollbar {
  width: 4px;
}

.custom-modal-content::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 10px;
}

.custom-modal-content:hover::-webkit-scrollbar-thumb,
.custom-modal-content.is-scrolling::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
}

.modern-form label {
  color: #bdc3c7;
}

.modern-form label i {
  color: #3498db;
  width: 14px;
  text-align: center;
}

.modern-form input,
.modern-form select,
.modern-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 0.9rem;
  box-sizing: border-box;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.05); /* Very subtle dark/transparent */
  color: #ecf0f1;
}

.modern-form input:focus,
.modern-form select:focus,
.modern-form textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08); /* Slightly more visible on focus */
}

.modern-form input[type="color"] {
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.readonly-field {
  background: rgba(0, 0, 0, 0.3) !important;
  color: #95a5a6;
  cursor: not-allowed;
}

.field-hint {
  font-size: 0.75rem;
  color: #7f8c8d;
  margin-top: 4px;
  display: block;
}

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

.form-actions .btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  min-width: 120px;
  justify-content: center;
}

.form-actions .btn-cancel {
  background: rgba(255, 255, 255, 0.05);
  color: #ecf0f1;
}

.form-actions .btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.form-actions .btn-primary {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.form-actions .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

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

/* Leaflet Popup Dark Theme */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: #2c3e50 !important;
    color: #ecf0f1 !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-content {
    margin: 12px 15px !important;
}

.device-popup {
    color: #ecf0f1;
}

.device-popup strong {
    color: #fff;
}

.device-details div {
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 2px;
}

.device-details div:last-child {
    border-bottom: none;
}

.device-details strong {
    color: #3498db;
    margin-right: 4px;
}

.vendor-field .vendor-value {
    font-weight: 600;
}

/* Legacy styles - kept for backward compatibility but overridden by modern styles */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex; justify-content: center; align-items: center; z-index: 2000;
  overflow-y: auto;
  padding: 20px 0;
}
.modal-content {
  background-color: #2c3e50; border-radius: 8px; padding: 20px;
  width: 90%; max-width: 500px; max-height: calc(100vh - 40px); 
  overflow-y: auto;
  margin: auto;
  color: #ecf0f1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-content h2 { margin-top: 0; color: #fff; }

.btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #ecf0f1;
}
.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.2);
}
.btn-primary {
  background: #3498db;
  color: #fff;
}
.btn-primary:hover {
  background: #2980b9;
}

/* No need for body padding - handled by main-container bottom */

/* User dropdown */
.user-dropdown { position: relative; margin-left: auto; }
.user-trigger {
  display: flex; align-items: center; cursor: pointer;
  padding: 5px 10px; border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s;
}
.user-trigger:hover { background-color: rgba(255, 255, 255, 0.2); }
.user-icon { margin-right: 8px; font-size: 16px; }
.user-name { margin-right: 8px; font-size: 14px; }
.dropdown-arrow { font-size: 10px; }
.user-dropdown-content {
  display: none; position: absolute; top: 40px; right: 0;
  background-color: #1a2530; min-width: 200px; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); z-index: 1002; padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.user-dropdown-content.show { display: block; }
.user-info-details {
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.user-info-details p { margin: 5px 0; color: #ecf0f1; font-size: 14px; }
.profile-btn, .logout-btn {
  display: block; padding: 10px 12px; border-radius: 6px;
  text-decoration: none; font-size: 14px; text-align: center; margin-bottom: 8px;
  font-weight: 600;
  transition: all 0.2s;
}
.profile-btn { background: #3498db; color: white; }
.logout-btn { background: #e74c3c; color: white; }
.profile-btn:hover { background: #2980b9; transform: translateY(-1px); }
.logout-btn:hover { background: #c0392b; transform: translateY(-1px); }

/* Utility */
.text-success { color: #2ecc71; }
.text-danger  { color: #e74c3c; }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex; justify-content: center; align-items: center; z-index: 2000;
  overflow-y: auto;
  padding: 20px 0;
  backdrop-filter: blur(4px);
}
.modal-content {
  background-color: #1a2530; 
  color: #ecf0f1;
  border-radius: 12px; 
  padding: 24px;
  width: 90%; 
  max-width: 500px; 
  max-height: calc(100vh - 40px); 
  overflow-y: auto;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  position: relative; /* Coordinate system for dropdowns */
}
.modal-content h2 { 
  margin-top: 0; 
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

/* Login page */
body.login-page {
  background-color: #0f172a;
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; height: 100vh; margin: 0; padding: 20px; box-sizing: border-box;
  color: #ecf0f1;
}
.login-container {
  background-color: #1a2530; border-radius: 16px;
  width: 100%; max-width: 400px; padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); position: relative; margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
@media (max-width: 768px) { .login-container { max-width: 90%; padding: 20px; } }

/* Messages */
.success-message {
  background-color: rgba(46,204,113,0.2);
  color: #2ecc71; padding: 10px; border-radius: 4px; margin-bottom: 15px;
  border-left: 4px solid #2ecc71;
}
.error-message {
  background-color: rgba(231,76,60,0.2);
  color: #e74c3c; padding: 10px; border-radius: 4px; margin-bottom: 15px;
  border-left: 4px solid #e74c3c;
}

/* Leaflet Popups */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: #1a2530 !important;
  color: #ecf0f1 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.leaflet-popup-content {
  margin: 15px !important;
  line-height: 1.6 !important;
}

.leaflet-popup-content h3, .leaflet-popup-content h4 {
  color: #ffffff !important;
  margin-top: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  padding-bottom: 8px !important;
}

.leaflet-popup-content .popup-label {
  color: #94a3b8 !important;
  font-weight: 600 !important;
}

.leaflet-popup-content .popup-value {
  color: #ecf0f1 !important;
}

.leaflet-popup-close-button {
  color: #bdc3c7 !important;
  padding: 8px !important;
}

.leaflet-popup-close-button:hover {
  color: #ffffff !important;
}

/* iOS Safari fix */
@supports (-webkit-overflow-scrolling: touch) {
  html, body { height: -webkit-fill-available; }
  .layout-wrapper { height: -webkit-fill-available; }
  .sidebar, .main-content, #map { -webkit-overflow-scrolling: touch; }
}

/* Debug button (opsional) */
.debug-toggle-button {
  position: fixed;
  bottom: 70px; right: 20px;
  z-index: 9999;
  padding: 10px; background: #e74c3c; color: white;
  border: none; border-radius: 4px; cursor: pointer;
}

/* Bootstrap-style badges compatibility */
.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  display: inline-block;
}

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

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

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

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

.badge-secondary {
  background: linear-gradient(135deg, #636e72 0%, #2d3436 100%);
  color: white;
}

/* Card styles for compatibility */
.card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
}

.card-body {
  padding: 24px;
}

.table-responsive {
  overflow-x: auto;
}

/* Form styles */
.form-group {
  margin-bottom: 16px;
}

.form-control {
  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.95rem;
  color: #ffffff;
  transition: all 0.2s ease;
}

.form-control: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);
}

.form-control-sm {
  padding: 6px 10px;
  font-size: 0.9rem;
}

/* Text utilities */
.text-center {
  text-align: center;
}

.text-muted {
  color: #6c757d;
}

.text-success {
  color: #00b894;
}

.text-danger {
  color: #d63031;
}

/* Alert styles */
.alert {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: none;
}

.alert-danger {
  background: linear-gradient(135deg, #fab1a0 0%, #e17055 100%);
  color: #2d3436;
  border-left: 4px solid #d63031;
}

.alert-success {
  background: linear-gradient(135deg, #81ecec 0%, #00cec9 100%);
  color: #2d3436;
  border-left: 4px solid #00b894;
}

.alert-info {
  background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
  color: white;
  border-left: 4px solid #0984e3;
}

