/* styles.css */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8fafc;
  color: #334155;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Improved responsive container */
.container {
  max-width: 100%;
  padding: 0 0.75rem;
}

/* Mobile menu button */
/* Mobile menu button - now an app bar */
#mobile-menu-btn {
  display: none; /* Hidden by default on desktop */
  position: fixed;
  top: 0;
  left: 0;
  right: 0; /* Occupy full width */
  height: 4rem; /* Height of the app bar */
  background-color: #1e293b; /* Same as sidebar menu */
  color: rgba(96,165,250,0.2); /* Hamburger icon color */
  border: none;
  border-radius: 0; /* No border-radius for a bar */
  padding: 0; /* Remove padding from button itself */
  z-index: 100; /* Ensure it's on top */
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Subtle shadow */
  font-size: 1.5rem; /* Size of the hamburger icon */
}

#mobile-menu-btn:hover {
  transform: none; /* No translateY on hover for a bar */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Slightly stronger shadow on hover */
}

/* Responsive sidebar */
@media (max-width: 768px) {
  #mobile-menu-btn {
    display: flex; /* Show and center the app bar on mobile */
    align-items: center;
    justify-content: center;
  }

  .flex {
    flex-direction: column;
  }

  .w-1\/4, .w-3\/4 {
    width: 100%;
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    width: 80%;
    max-width: 250px;
    z-index: 50;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding-top: 4rem;
    background: #1e293b;
  }

  .mobile-menu-open #sidebar {
    left: 0;
  }

  #content {
    margin-left: 0;
    padding: 4rem 0.75rem 0.75rem;
    width: 100%;
  }
}

/* Table enhancements */
.table-container {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  margin: 1rem 0;
  border: 1px solid #e2e8f0;
  background: white;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  background-color: #0f172a;
  color: white;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.85rem;
}

td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
}

tr:nth-child(even) {
  background-color: #f1f5f9;
}

tr:hover {
  background-color: #e0f2fe;
}

/* Form enhancements */
.grid-cols-1, .grid-cols-2, .grid-cols-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .grid-cols-2 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .grid-cols-3 {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

input, textarea, select, button {
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  width: 100%;
  box-sizing: border-box;
}

textarea, select {
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  background: white;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

input:focus, textarea:focus, select:focus {
  border-color: #60a5fa;
  outline: none;
  box-shadow: 0 0 0 3px rgba(96,165,250,0.2);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

button {
  padding: 0.5rem 1rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background-color: #2563eb;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

button:hover {
  background-color: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button:active {
  transform: translateY(0);
}

/* Login form enhancements */
#login-section {
  max-width: 400px;
  margin: 2rem auto;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border-radius: 12px;
  background: white;
  transition: all 0.3s ease;
}

@media (max-width: 640px) {
  #login-section {
    margin: 1rem;
    padding: 1rem;
  }
}

#login-section:hover {
  box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

#login-btn {
  background: linear-gradient(to right, #2563eb, #1d4ed8);
  font-weight: 600;
  width: 100%;
}

#login-btn:hover {
  background: linear-gradient(to right, #1d4ed8, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(29, 78, 216, 0.25);
}

/* Header and titles */
h2.text-2xl {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #dbeafe;
  margin-bottom: 1rem;
}

/* Welcome message */
#welcome-message {
  background: white;
  color: #1e293b; /* Color of the app bar */
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: none; /* Remove shadow for white background */
}

.bg-gray-800 a:hover {
  background: #1e293b;
  transform: translateX(5px);
}

.bg-gray-800 a::before {
  content: "→";
  margin-right: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bg-gray-800 a:hover::before {
  opacity: 1;
}

/* Scrollbar styling */
.table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

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

/* Form group styling */
.mb-4 {
  margin-bottom: 1rem;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 640px) {
  .table-container {
    overflow-x: auto;
  }

  table {
    min-width: 100%;
  }

  th, td {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
  }

  input, textarea, select, button {
    font-size: 0.85rem;
    padding: 0.4rem;
  }

  h2.text-2xl {
    font-size: 1.1rem;
  }

  button {
    padding: 0.4rem 0.75rem;
  }
}

/* Loading indicator */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-right: 6px;
}

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

/* Button icons */
button .icon {
  font-size: 1rem;
}

/* Alert messages */
.alert {
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.alert-error {
  background: #fee2e2;
  color: #b91c1c;
}

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

/* Login input focus */
#username:focus, #password:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Ensure touch-friendly targets */
a, button, input, textarea, select {
  min-height: 44px; /* Minimum touch target size for accessibility */
}