
html {
  height: 100%;
  width: 100%;
}

body {
  position: relative;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  height: 100%;
  background: #f5f7fa;
  color: #2d3748;
  display: flex;
  flex-direction: column;
}

header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #2d3748;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo img {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.logo h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: #2d3748;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #4a5568;
  background: #f7fafc;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.logout-btn {
  background: #e53e3e;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  color: white;
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.app-container {
  display: flex;
  height: calc(100vh - 70px);
  gap: 16px;
  padding: 16px;
  box-sizing: border-box;
}

/* Sidebar Styles */
.sidebar {
  width: 320px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
}

.sidebar-section {
  padding: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 500;
  color: #2d3748;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-section h2::before {
  content: '';
  width: 3px;
  height: 16px;
  background: #4299e1;
  border-radius: 1px;
}

.sidebar-section select,
.sidebar-section input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  background: white;
  box-sizing: border-box;
}

.sidebar-section select:focus,
.sidebar-section input:focus {
  border-color: #4299e1;
  box-shadow: 0 0 0 1px #4299e1;
}

.sidebar-section button {
  padding: 10px 16px;
  width: calc(50% - 4px);
  background: #4299e1;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin: 4px 2px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.sidebar-section button:hover {
  background: #3182ce;
}

.sidebar-section button:active {
  transform: translateY(1px);
}

#clearButton {
  background: #718096;
  color: white;
}

#clearButton:hover {
  background: #4a5568;
}

.sidebar-links {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.sidebar-link {
  padding: 12px 16px;
  text-decoration: none;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.sidebar-link:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

/* Toggle Switch */
.toggle-section {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 15px;
  padding: 15px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
  margin-right: 15px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #bdc3c7, #95a5a6);
  transition: .4s;
  border-radius: 30px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

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

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50;
}

/* Map Container */
.map-container {
  flex: 1;
  position: relative;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

#map {
  height: 100%;
  width: 100%;
  border-radius: 8px;
}

.search-overlay {
  position: absolute;
  top: 25px;
  left: 25px;
  z-index: 10;
  width: 350px;
}

.search-overlay input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  background: white;
  box-sizing: border-box;
}

.search-overlay input:focus {
  border-color: #4299e1;
  box-shadow: 0 0 0 1px #4299e1;
}

.zone-buttons-container {
  position: absolute;
  top: 25px;
  right: 25px;
  z-index: 10;
  max-width: 450px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.zone-buttons-container details {
  width: 100%;
}

.zone-buttons-container summary {
  padding: 18px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  background: rgba(102, 126, 234, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  outline: none;
  transition: all 0.3s ease;
  color: #2c3e50;
}

.zone-buttons-container summary:hover {
  background: rgba(102, 126, 234, 0.2);
}

.zone-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px;
  max-height: 350px;
  overflow-y: auto;
}

.zone-button-group button {
  padding: 10px 16px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #2c3e50;
}

.zone-button-group button:hover {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.clear-zone-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
  color: white !important;
}

.clear-zone-btn:hover {
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4) !important;
}

.floating-buttons {
  position: absolute;
  bottom: 25px;
  right: 25px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.floating-buttons button {
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.floating-buttons button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

#downloadZoneDataButton {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}

#downloadZoneDataButton:hover {
  box-shadow: 0 12px 35px rgba(39, 174, 96, 0.4);
}

#downloadVisibleZonesButton {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

#downloadVisibleZonesButton:hover {
  box-shadow: 0 12px 35px rgba(52, 152, 219, 0.4);
}

/* InfoWindow Styling */
.gm-style-iw {
  padding: 15px !important;
  border-radius: 15px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15) !important;
  background: rgba(255, 255, 255, 0.98) !important;
  backdrop-filter: blur(10px) !important;
}

.gm-style-iw h4 {
  margin-top: 0;
  color: #2c3e50;
  border-bottom: 2px solid #667eea;
  padding-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    margin: 10% auto;
    padding: 30px;
    border: none;
    width: 85%;
    max-width: 650px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    backdrop-filter: blur(15px);
}

.modal textarea {
    width: 100%;
    margin: 15px 0;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    resize: vertical;
    font-family: 'Inter', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.modal textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 60vh;
  }

  .map-container {
    height: 40vh;
  }

  .search-overlay,
  .zone-buttons-container {
    position: static;
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
  }

  .floating-buttons {
    position: static;
    padding: 15px;
    flex-direction: row;
    justify-content: center;
  }

  .sidebar-section button {
    width: 100%;
    margin: 5px 0;
  }
}

/* Student Info Display */
#student-info-display {
  min-height: 120px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 15px;
  padding: 15px;
  font-size: 14px;
  color: #2c3e50;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

/* QR Code Styles */
#qrcode-container {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  text-align: center;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

#qrcode {
  display: inline-block;
  margin: 0 auto 15px;
  padding: 15px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Name Search Autocomplete Styles */
.name-search-container {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 2px;
}

.autocomplete-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background-color: #f8f9fa;
}

.autocomplete-item.selected {
  background-color: #667eea;
  color: white;
}

.student-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 4px;
}

.autocomplete-item.selected .student-name {
  color: white;
}

.student-details {
  font-size: 12px;
  color: #7f8c8d;
  display: flex;
  gap: 15px;
}

.autocomplete-item.selected .student-details {
  color: rgba(255,255,255,0.9);
}

.autocomplete-highlight {
  background-color: #fff3cd;
  font-weight: bold;
  padding: 1px 2px;
  border-radius: 2px;
}

.autocomplete-item.selected .autocomplete-highlight {
  background-color: rgba(255,255,255,0.3);
  color: white;
}

.no-results {
  padding: 15px;
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
}

.qr-button {
  margin-top: 12px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.qr-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#printIDCard {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}

#printIDCard:hover {
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

#batchPrintButton {
  background: linear-gradient(135deg, #f39c12, #e67e22);
}

#batchPrintButton:hover {
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

#batch-id-container {
  margin-top: 20px;
  border-top: 2px solid rgba(102, 126, 234, 0.1);
  padding-top: 20px;
  text-align: left;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 15px;
  padding: 20px;
}

#batch-id-container h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
}

#batch-id-container p {
  margin: 8px 0;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

#batch-student-ids {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e8ed;
  border-radius: 12px;
  font-family: 'Inter', monospace;
  font-size: 14px;
  resize: vertical;
  margin: 10px 0 15px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

#batch-student-ids:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#generate-batch-cards {
  background: linear-gradient(135deg, #f39c12, #e67e22);
}

#generate-batch-cards:hover {
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

#id-card-buttons {
  display: flex;
  gap: 12px;
  margin-top: 15px;
}

/* Login page specific styles */
#login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-form {
  max-width: 420px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 25px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-form h2 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 25px;
  font-weight: 700;
  font-size: 28px;
}

.login-subtitle {
  text-align: center;
  color: #7f8c8d;
  margin-bottom: 35px;
  font-size: 15px;
  line-height: 1.5;
}

.input-group {
  margin-bottom: 25px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.input-group input {
  width: 100%;
  padding: 15px;
  border: 2px solid #e1e8ed;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.input-group input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.login-button {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

#updateRouteButton {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

#updateRouteButton:hover {
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* Clear Cache Button Styles */
.cache-section {
  padding: 15px;
  background: rgba(255, 193, 7, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(255, 193, 7, 0.3);
  margin-top: 10px;
}

.cache-help-text {
  font-size: 12px;
  color: #856404;
  margin-bottom: 10px;
  line-height: 1.4;
  font-style: italic;
}

.cache-clear-btn {
  padding: 8px 12px !important;
  width: auto !important;
  font-size: 12px !important;
  background: linear-gradient(135deg, #ffc107, #e0a800) !important;
  color: #212529 !important;
  margin: 0 !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3) !important;
}

.cache-clear-btn:hover {
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4) !important;
  transform: translateY(-1px) !important;
}

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

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-section {
  animation: fadeIn 0.6s ease-out;
}

/* Improved button hover effects */
button {
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}
