/* Custom styles for proper footer positioning */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.content-wrapper {
  flex: 1 0 auto;
  width: 100%;
}

footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
}

/* Ensure main layout doesn't interfere */
.main-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Footer positioning fix */
.footer-spacer {
  min-height: calc(100vh - 80px);
}

/* Table sorting styles */
.sortable-header {
  transition: background-color 0.2s ease;
  user-select: none;
}

.sortable-header:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.sortable-header.sorted {
  background-color: rgba(59, 130, 246, 0.1);
}

.sort-icon {
  display: inline-block;
  font-size: 0.8em;
  color: #6b7280;
  transition: color 0.2s ease;
}

.sortable-header:hover .sort-icon {
  color: #374151;
}

.sortable-header.sorted .sort-icon {
  color: #3b82f6;
  font-weight: bold;
}

/* Table responsive improvements */
@media (max-width: 768px) {
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .table-container table {
    min-width: 600px;
  }

  /* Mobile-specific button adjustments */
  .btn-group {
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn-group button {
    width: 100%;
  }
}

/* Pagination styles */
.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.pagination-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-nav a,
.pagination-nav span {
  transition: all 0.2s ease;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  text-decoration: none;
  font-size: 0.875rem;
}

.pagination-nav a:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: #f9fafb;
}

.pagination-nav .current {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.pagination-nav .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading spinner */
.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

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

/* Enhanced form styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.error {
  border-color: #ef4444;
}

.field-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Enhanced button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

/* Tooltip improvements */
.tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: #1f2937;
  color: white;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.875rem;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Enhanced card styles */
.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* Status indicators */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.status-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.error {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.info {
  background: #dbeafe;
  color: #1e40af;
}

/* Responsive utilities */
@media (max-width: 640px) {
  .btn {
    width: 100%;
    justify-content: center;
  }

  .btn-group {
    flex-direction: column;
  }

  .tooltip-text {
    width: 150px;
    margin-left: -75px;
    font-size: 0.8rem;
  }

  .card {
    margin: 0.5rem;
  }

  .pagination-nav {
    gap: 0.25rem;
  }

  .pagination-nav a,
  .pagination-nav span {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
}