/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

/* Header Styles - Dark Theme */
.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

/* Hamburger Menu Button */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 25px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger-btn span {
  width: 100%;
  height: 3px;
  background-color: white;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

.logo {
  height: 60px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.header-text h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  color: #ffffff;
}

.header-text p {
  font-size: 1.1rem;
  opacity: 0.9;
  color: #e8f4f8;
  font-weight: 300;
}

/* Main Container Layout */
.main-container {
  display: flex;
  gap: 0;
  max-width: 100%;
  margin: 0;
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

/* Sidebar Styles */
.sidebar {
  width: 300px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-right: 3px solid #0f3460;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  min-height: 89vh;
  max-height: 89vh;
  padding: 1rem;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar h3 {
  color: #1a1a2e;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border-bottom: 2px solid #0f3460;
  text-align: center;
  flex-shrink: 0;
}

/* Status Section */
.status-section {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 8px;
  padding: 0.4rem;
  margin-bottom: 1rem;
  border: 2px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.status-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.7rem;
  line-height: 1.2;
}

.status-icon {
  font-size: 0.9rem;
  margin-right: 0.2rem;
}

.status-text {
  color: #495057;
  font-weight: 500;
  white-space: nowrap;
}

.status-separator {
  color: #6c757d;
  font-weight: 300;
  margin: 0 0.3rem;
}

.status-text.highlight {
  color: #0f3460;
  font-weight: 600;
}

/* Search Container */
.search-container {
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
  outline: none;
  border-color: #0f3460;
  box-shadow: 0 4px 10px rgba(15, 52, 96, 0.2);
}

.search-input::placeholder {
  color: #6c757d;
  opacity: 0.8;
}

.search-results {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #6c757d;
  text-align: center;
}

.camera-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
  padding-right: 0.5rem;
}

.camera-list::-webkit-scrollbar {
  width: 6px;
}

.camera-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.camera-list::-webkit-scrollbar-thumb {
  background: #0f3460;
  border-radius: 3px;
}

.camera-list::-webkit-scrollbar-thumb:hover {
  background: #1a1a2e;
}

/* Hidden state for filtered items */
.camera-item.hidden {
  display: none;
}

/* No results message */
.no-results {
  text-align: center;
  padding: 2rem 1rem;
  color: #6c757d;
  font-style: italic;
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.camera-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.camera-item:hover {
  background: #0f3460;
  color: white;
  transform: translateX(5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.camera-item.active {
  background: #0f3460;
  color: white;
  border-color: #1a1a2e;
}

.camera-icon {
  font-size: 1.5rem;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.camera-info h4 {
  margin: 0 0 0.2rem 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.camera-info p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.8;
}

.camera-item:hover .camera-info p {
  opacity: 1;
}

/* Map Wrapper */
.map-wrapper {
  flex: 1;
  padding: 0;
}

/* Map Container Styles */
#map {
  height: 89vh;
  width: 100%;
  border-radius: 8px;
  margin: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid #e9ecef;
}

.map-container {
  padding: 0;
}

/* Leaflet Popup Customization */
.leaflet-popup-content {
  font-size: 0.9rem;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.4;
  color: #333;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-tip {
  background: white;
  border: none;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
}

/* CCTV Popup Styles */
.cctv-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
  border: 2px solid #0f3460;
}

.cctv-popup .leaflet-popup-content {
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

.cctv-popup iframe {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #f8f9fa;
}

.cctv-popup .leaflet-popup-close-button {
  background: #0f3460;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  right: 8px;
  top: 8px;
  transition: all 0.3s ease;
}

.cctv-popup .leaflet-popup-close-button:hover {
  background: #1a1a2e;
  transform: scale(1.1);
}

/* Footer Styles - Light Theme */
.footer {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #495057;
  padding: 3rem 0 1rem;
  margin-top: 3rem;
  border-top: 3px solid #0f3460;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer-section h4 {
  color: #1a1a2e;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  font-weight: 600;
  border-bottom: 2px solid #0f3460;
  padding-bottom: 0.5rem;
}

.footer-section p {
  margin-bottom: 0.5rem;
  color: #6c757d;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-section .icon {
  font-size: 1.1rem;
  width: 20px;
  display: inline-block;
}

/* Social Links */
.social-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #495057;
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.social-link:hover {
  background-color: #0f3460;
  color: white;
  transform: translateX(5px);
}

.social-icon {
  font-size: 1.2rem;
  width: 20px;
  display: inline-block;
}

.social-icon-img {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
  filter: brightness(0.7);
  transition: filter 0.3s ease;
}

.social-link:hover .social-icon-img {
  filter: brightness(1) invert(1);
}

/* Footer Bottom */
.footer-bottom {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #dee2e6;
  text-align: center;
  color: #6c757d;
}

.footer-tech {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
    position: fixed;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px;
    border-radius: 5px;
    z-index: 1002;
  }
  
  .header-content {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
  }

  .header-logo {
    text-align: center;
  }

  .logo {
    height: 50px;
  }
  
  .header-text {
    text-align: center;
  }
  
  .header-text h1 {
    font-size: 1.8rem;
  }
  
  .header-text p {
    font-size: 1rem;
  }
  
  .main-container {
    flex-direction: row;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 1000;
    border-right: 3px solid #0f3460;
    border-bottom: none;
    min-height: 100vh;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .map-wrapper {
    width: 100%;
  }
  
  #map {
    height: 60vh;
    border-radius: 5px;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }
  
  .social-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .logo {
    height: 40px;
  }
  
  .header-text h1 {
    font-size: 1.3rem;
  }
  
  .header-text p {
    font-size: 0.9rem;
  }
  
  .hamburger-btn {
    top: 12px;
    left: 12px;
    padding: 6px;
  }
  
  #map {
    margin: 1rem auto;
  }
  
  .footer {
    padding: 2rem 0 1rem;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: #0f3460;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #1a1a2e;
}

/* Loading Animation (for future use) */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0f3460;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Terms of Service Link */
.footer-links {
  margin-top: 1rem;
}

.footer-link {
  color: #0f3460;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  border-bottom: 1px solid transparent;
}

.footer-link:hover {
  color: #1a1a2e;
  border-bottom: 1px solid #1a1a2e;
  text-decoration: none;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  padding: 1rem 0rem;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
  overflow: hidden;
}

.modal-content h2 {
  color: #0f3460;
  margin-bottom: 1rem;
  font-size: 1.8rem;
  padding: 0rem 1rem;
  border-bottom: 2px solid #0f3460;
  padding-bottom: 0.5rem;
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 30px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  hover: {
    background: #f0f0f0;
  }
}

.close:hover {
  color: #0f3460;
  background: #f0f0f0;
}

.iframe-container {
  width: 100%;
  height: 60vh;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e9ecef;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Terms of Service First Access Popup */
.tos-first-access {
  z-index: 2500;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.tos-first-access-content {
  max-width: 600px;
  border: 3px solid #0f3460;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.tos-first-access-content h2 {
  color: #0f3460;
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  border-bottom: 3px solid #0f3460;
  padding-bottom: 0.5rem;
}

.tos-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.tos-header p {
  color: #495057;
  font-size: 1rem;
  padding: 0rem 1rem;
  line-height: 1.6;
  margin-top: 0.5rem;
}

.tos-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.accept-btn, .decline-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
}

.accept-btn {
  background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(15, 52, 96, 0.3);
}

.accept-btn:hover {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 52, 96, 0.4);
}

.decline-btn {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.decline-btn:hover {
  background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

/* Responsive Modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    padding: 1rem;
    max-height: 95vh;
  }
  
  .modal-content h2 {
    font-size: 1.5rem;
  }
  
  .iframe-container {
    height: 50vh;
  }
  
  .close {
    top: 10px;
    right: 15px;
    font-size: 24px;
    width: 30px;
    height: 30px;
  }
  
  .tos-first-access-content {
    max-width: 95%;
    padding: 1rem;
  }
  
  .tos-first-access-content h2 {
    font-size: 1.4rem;
  }
  
  .tos-header p {
    font-size: 0.9rem;
  }
  
  .tos-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .accept-btn, .decline-btn {
    width: 100%;
    max-width: 250px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 98%;
    padding: 0.5rem;
  }
  
  .modal-content h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }
  
  .iframe-container {
    height: 45vh;
  }
}
