/* Sri Lanka Railway Quarters Details Management System - Stylesheet */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles */
.header {
  background-color: #2c3e50;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
}

.logo-subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  color: #bdc3c7;
  margin-left: 40px;
}

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.user-info {
  color: #ecf0f1;
  font-size: 0.9rem;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger-line {
  width: 25px;
  height: 3px;
  background-color: white;
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem 0;
}

.content-wrapper {
  background-color: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Footer Styles */
.footer {
  background-color: #34495e;
  color: white;
  text-align: center;
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* Login Page Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.login-box {
  background-color: white;
  padding: 2.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 400px;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  color: #2c3e50;
  text-align: center;
}

.login-form {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #555;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-title {
  margin-bottom: 1rem;
  color: #2c3e50;
  font-size: 1.5rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.3s;
  text-align: center;
  align-content: center;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
}

.btn-block {
  width: 100%;
  display: block;
}

.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-error {
  background-color: #fee;
  color: #c33;
  border: 1px solid #fcc;
}

.login-info {
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  text-align: center;
}

.login-info code {
  background-color: #e9ecef;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-family: monospace;
}

/* Dashboard Styles */
.dashboard {
  min-height: 500px;
}

.dashboard-header {
  margin-bottom: 2rem;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 1rem;
}

.dashboard-header h2 {
  color: #2c3e50;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #7f8c8d;
  font-size: 1rem;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  font-size: 2.5rem;
}

.stat-content h3 {
  font-size: 1rem;
  color: #7f8c8d;
  margin-bottom: 0.5rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: #95a5a6;
}

.dashboard-content {
  display: grid;
  gap: 2rem;
}

.content-section {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 1.5rem;
}

.content-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.activity-list {
  min-height: 100px;
}

.text-muted {
  color: #95a5a6;
  font-style: italic;
}

.select-location-btn {
  margin-bottom: 1rem;
  background-color: #e74c3c;
}

/* Responsive Design */
@media (max-width: 900px) {
  .header-content {
    flex-wrap: wrap;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #2c3e50;
    flex-direction: column;
    gap: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .nav.active {
    max-height: 500px;
    padding: 1rem 0;
  }

  .nav-link {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 0;
    text-align: left;
  }

  .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
  }

  .user-info {
    width: 100%;
    padding: 1rem 1.5rem;
    text-align: left;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .logo {
    font-size: 1.2rem; /* smaller logo */
  }

  .logo-subtitle {
    font-size: 0.75rem; /* smaller subtitle */
    margin-left: 0px; /* remove margin on small screens */
    text-align: center;
  }

  .form-title {
    text-align: center;
  }

  .login-box {
    padding: 0rem;
    /* No box shadow in the mobile view */
    box-shadow: none;
  }
}

/* Locations Page Styles */
.locations-page {
  min-height: 400px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #ecf0f1;
}

.page-header h2 {
  margin-bottom: 0;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.data-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #495057;
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid #dee2e6;
}

.data-table tbody tr:hover {
  background-color: #f8f9fa;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Action Buttons */
.actions-cell {
  white-space: nowrap;
}

.btn-action {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  margin-right: 0.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background-color 0.3s;
}

.btn-edit {
  background-color: #3498db;
  color: white;
}

.btn-edit:hover {
  background-color: #2980b9;
}

.btn-view {
  background-color: #27ae60;
  color: white;
}

.btn-view:hover {
  background-color: #229954;
}

.btn-delete {
  background-color: #e74c3c;
  color: white;
}

.btn-delete:hover {
  background-color: #c0392b;
}

/* Secondary Button */
.btn-secondary {
  background-color: #95a5a6;
  color: white;
  margin-left: 0.5rem;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Success Alert */
.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-state p {
  font-size: 1rem;
  color: #6c757d;
}

.empty-state a {
  color: #3498db;
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* Clickable stat card */
.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat-card-link:hover .stat-card {
  cursor: pointer;
}

.flex-table {
  display: flex;
  flex-direction: column;
}

.flex-row {
  display: flex;
  flex-direction: row;
}

.homedetails-form-section-group {
  margin-bottom: 1.5rem;
  border: 1px solid #ddd;
  padding: 1rem;
}

/* Filter Section */
.filter-section {
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
}

.filter-field label {
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #555;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Autocomplete Styles */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-input {
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background-color: #f0f7ff;
}

.autocomplete-item strong {
  color: #2c3e50;
}

/* Mobile-responsive table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.home-details-table {
  min-width: 800px;
}

/* Responsive adjustments for table */
@media (max-width: 900px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .data-table {
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem 0.5rem;
  }

  .btn-action {
    display: block;
    margin-bottom: 0.5rem;
    margin-right: 0;
  }

  .filter-group {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions .btn {
    width: 100%;
    margin-left: 0rem;
  }
}

/* Mobile table view - card style */
@media (max-width: 768px) {
  .mobile-hide {
    display: none;
  }

  .home-details-table {
    min-width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: white;
  }

  .data-table tbody tr:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
  }

  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #495057;
    text-align: left;
    flex: 1;
  }

  .data-table td.actions-cell {
    flex-direction: column;
    gap: 0.5rem;
  }

  .data-table td.actions-cell::before {
    margin-bottom: 0.5rem;
  }

  .btn-action {
    width: 100%;
    text-align: center;
  }
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-success {
  background-color: #27ae60;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s;
  display: inline-block;
}

.btn-success:hover {
  background-color: #229954;
}

@media (max-width: 768px) {
  .header-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .header-actions a {
    width: 100%;
    text-align: center;
  }
  
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .page-header h2 {
    text-align: center;
  }
}

/* App Update Overlay */
.app-update-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(44, 62, 80, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-update-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.app-update-content {
  text-align: center;
  color: white;
  padding: 2rem;
}

.app-update-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.app-update-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.app-update-message {
  font-size: 1.1rem;
  color: #bdc3c7;
  margin-bottom: 1.5rem;
}

.app-update-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

