/**
 * Modern Dashboard Styles for Otto Scooter Dashboard
 * 
 * Features:
 * - Clean, modern theme
 * - Bold headers with slightly shaded backgrounds
 * - Frozen header row
 * - Responsive design
 * - Improved visual hierarchy
 * - Consistent color scheme
 */

/* Base styles */
:root {
  --primary-color: #0056b3;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --border-color: #dee2e6;
  --header-bg: #f5f7f9;
  --hover-bg: #f0f4f8;
  --shadow-sm: 0 .125rem .25rem rgba(0,0,0,.075);
  --shadow-md: 0 .5rem 1rem rgba(0,0,0,.15);
  --transition-speed: 0.3s;
}

body {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.6;
}

/* Header styles */
.dashboard-header {
  background-color: white;
  box-shadow: var(--shadow-sm);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-title {
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
  display: inline-block;
  vertical-align: middle;
}

.dashboard-logo {
  height: 40px;
  margin-right: 1rem;
  vertical-align: middle;
}

/* Navigation tabs */
.nav-tabs {
  border-bottom: 1px solid var(--border-color);
  background-color: white;
  position: sticky;
  top: 73px; /* Adjust based on header height */
  z-index: 999;
  padding-top: 0.5rem;
}

.nav-tabs .nav-link {
  color: var(--secondary-color);
  border: none;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  transition: all var(--transition-speed);
  border-radius: 0;
  margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
  color: var(--primary-color);
  background-color: var(--hover-bg);
  border-bottom: 2px solid #ccc;
}

.nav-tabs .nav-link.active {
  color: var(--primary-color);
  font-weight: 600;
  background-color: transparent;
  border-bottom: 3px solid var(--primary-color);
}

/* Table styles */
.table-container {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  background-color: var(--header-bg);
  color: var(--dark-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  padding: 1rem 0.75rem;
  border-top: none;
  position: sticky;
  top: 124px; /* Adjust based on header + tabs height */
  z-index: 998;
  box-shadow: inset 0 1px 0 var(--border-color), inset 0 -1px 0 var(--border-color);
}

.table td {
  padding: 0.75rem;
  vertical-align: middle;
  border-top: 1px solid var(--border-color);
}

.table tbody tr:hover {
  background-color: var(--hover-bg);
}

/* Fixed column widths and improved display */
.table th, .table td {
  /* Remove nowrap to allow text wrapping */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  min-width: 120px; /* Minimum width for all columns */
  max-width: 250px; /* Maximum width for all columns */
}

/* Specific column widths */
.table th:nth-child(1), .table td:nth-child(1) { /* Action column */
  min-width: 80px;
  max-width: 80px;
}

.table th:nth-child(2), .table td:nth-child(2), /* Input Date */
.table th:nth-child(3), .table td:nth-child(3), /* Preferred Booking Date */
.table th:nth-child(11), .table td:nth-child(11), /* Licence Expiry */
.table th:nth-child(12), .table td:nth-child(12) { /* DOB */
  min-width: 120px;
  max-width: 120px;
}

.table th:nth-child(4), .table td:nth-child(4), /* Type of Session */
.table th:nth-child(5), .table td:nth-child(5) { /* Training Site */
  min-width: 150px;
  max-width: 180px;
}

.table th:nth-child(6), .table td:nth-child(6) { /* Rider Full Name */
  min-width: 180px;
  max-width: 220px;
}

.table th:nth-child(7), .table td:nth-child(7) { /* Email */
  min-width: 200px;
  max-width: 250px;
}

.table th:nth-child(8), .table td:nth-child(8) { /* Mobile */
  min-width: 130px;
  max-width: 130px;
}

.table th:nth-child(9), .table td:nth-child(9), /* NI Number */
.table th:nth-child(10), .table td:nth-child(10) { /* Licence No. */
  min-width: 140px;
  max-width: 140px;
}

.table th:nth-child(13), .table td:nth-child(13) { /* Address */
  min-width: 200px;
  max-width: 300px;
}

.table th:nth-child(14), .table td:nth-child(14), /* Booked? */
.table th:nth-child(15), .table td:nth-child(15) { /* Completed? */
  min-width: 100px;
  max-width: 100px;
}

.table th:nth-child(16), .table td:nth-child(16), /* Reason if No */
.table th:nth-child(17), .table td:nth-child(17), /* Instructor Notes */
.table th:nth-child(18), .table td:nth-child(18) { /* CS Notes */
  min-width: 180px;
  max-width: 250px;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Action buttons */
.action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 124px; /* Adjust based on header + tabs height */
  z-index: 997;
  background-color: #f8f9fa;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  transition: all var(--transition-speed);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: #004494;
  border-color: #004494;
}

.btn-success {
  background-color: var(--success-color);
  border-color: var(--success-color);
}

.btn-success:hover {
  background-color: #218838;
  border-color: #218838;
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.btn-secondary:hover {
  background-color: #5a6268;
  border-color: #5a6268;
}

.btn-outline-secondary {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.btn-outline-secondary:hover {
  color: white;
  background-color: var(--secondary-color);
}

/* Form controls */
.form-control {
  border-radius: 0.25rem;
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  transition: border-color var(--transition-speed);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 86, 179, 0.25);
}

.form-select {
  border-radius: 0.25rem;
  border: 1px solid var(--border-color);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  transition: border-color var(--transition-speed);
  background-position: right 0.75rem center;
}

.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 86, 179, 0.25);
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--dark-color);
}

/* Filter section */
.filter-section {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.filter-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--dark-color);
  font-size: 1rem;
}

/* Search box */
.search-box {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-box .form-control {
  padding-left: 2.5rem;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary-color);
}

/* Modal styles */
.modal-content {
  border-radius: 0.5rem;
  border: none;
  box-shadow: var(--shadow-md);
}

.modal-header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
}

.modal-title {
  font-weight: 600;
  color: var(--dark-color);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
}

/* Login modal */
.login-modal .modal-body {
  padding: 2rem;
}

.login-logo {
  margin-bottom: 1.5rem;
}

.login-title {
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--dark-color);
}

/* Card styles for reports */
.report-card {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
  height: 100%;
}

.report-card-header {
  background-color: var(--header-bg);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.report-card-title {
  font-weight: 600;
  margin: 0;
  color: var(--dark-color);
  font-size: 1rem;
}

.report-card-body {
  padding: 1.5rem;
}

/* Conditional formatting */
.status-not-booked {
  background-color: rgba(255, 193, 7, 0.2) !important;
}

.status-not-completed {
  background-color: rgba(220, 53, 69, 0.2) !important;
}

.status-completed {
  background-color: rgba(40, 167, 69, 0.1) !important;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .dashboard-title {
    font-size: 1.5rem;
  }
  
  .nav-tabs .nav-link {
    padding: 0.5rem 1rem;
  }
  
  .table th {
    top: 110px;
  }
  
  .action-buttons {
    top: 110px;
  }
}

@media (max-width: 768px) {
  .dashboard-title {
    font-size: 1.25rem;
  }
  
  .dashboard-logo {
    height: 30px;
  }
  
  .nav-tabs .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .table th {
    top: 100px;
  }
  
  .action-buttons {
    top: 100px;
    flex-wrap: wrap;
  }
  
  .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* Notification styles */
#notification-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.notification {
  margin: 10px;
  padding: 15px 20px;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: opacity 0.3s ease-in-out;
  min-width: 250px;
}

/* Spinner and loading indicators */
.spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}

/* Utility classes */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.rounded {
  border-radius: 0.25rem !important;
}
