/**
 * Service Records Styles for VehicleTrace
 */

/* Adjust My Vehicles grid to 2-across */
.my-vehicles-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 700px) {
  .my-vehicles-list {
    grid-template-columns: 1fr;
  }
}

/* Service Records Section within vehicle card */
.service-records-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.service-records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.service-records-toggle {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.service-records-toggle:hover {
  background: #e5e7eb;
}

/* Public toggle switch */
.service-public-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
}

.service-public-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.toggle-label {
  user-select: none;
}

/* Service Records Content */
.service-records-content {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
}

.service-records-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.no-records {
  color: #9ca3af;
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem 0;
}

/* Individual Service Record Item */
.service-record-item {
  display: flex;
  flex-direction: column;
  padding: 0.6rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.service-record-item:last-child {
  margin-bottom: 0;
}

.service-record-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #f3f4f6;
}

.service-record-actions button {
  background: none;
  border: none;
  padding: 0.2rem;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.7;
  transition: opacity 0.2s;
  line-height: 1;
}

.service-record-actions button:hover {
  opacity: 1;
}

.service-record-info {
  flex: 1;
}

.service-record-date {
  font-weight: 600;
  font-size: 0.85rem;
  color: #374151;
}

.service-record-desc {
  font-size: 0.8rem;
  color: #4b5563;
  margin-top: 0.2rem;
}

.service-record-mileage,
.service-record-provider {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.1rem;
}

/* Add Service Record Button */
.btn-add-service {
  width: 100%;
  padding: 0.5rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.btn-add-service:hover {
  background: #2563eb;
}

/* Add Service Record Modal */
#addServiceRecordModal .modal-content {
  max-width: 500px;
}

#addServiceRecordModal .form-group {
  margin-bottom: 1rem;
}

#addServiceRecordModal label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

#addServiceRecordModal input,
#addServiceRecordModal textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9rem;
}

#addServiceRecordModal textarea {
  resize: vertical;
  min-height: 60px;
}

#serviceDocumentPreview {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #f3f4f6;
  border-radius: 4px;
  text-align: center;
}

.pdf-preview {
  padding: 1rem;
  color: #4b5563;
}

/* Loading states */
.loading-small {
  text-align: center;
  padding: 0.5rem;
  color: #9ca3af;
  font-size: 0.85rem;
}

/* Redaction notice */
.redaction-notice {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.redaction-notice strong {
  color: #92400e;
}

/* Service Records Dashboard Button */
.btn-service-dashboard {
  background: #10b981;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-service-dashboard:hover {
  background: #059669;
}

/* Service Records Dashboard Modal */
#serviceRecordsDashboardModal .modal-content {
  max-width: 1000px;
}

.service-dashboard-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
}

.service-dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.service-dashboard-table thead {
  background: #f3f4f6;
}

.service-dashboard-table th {
  padding: 0.75rem 0.5rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}

.service-dashboard-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
}

.service-dashboard-table tbody tr:hover {
  background: #f9fafb;
}

.service-dashboard-table .vin-cell {
  font-family: monospace;
  font-size: 0.8rem;
  color: #6b7280;
}

.btn-view-doc-table {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-view-doc-table:hover {
  background: #2563eb;
}

.btn-delete-doc-table {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-delete-doc-table:hover {
  background: #dc2626;
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Responsive table */
@media (max-width: 768px) {
  .service-dashboard-table {
    font-size: 0.8rem;
  }
  
  .service-dashboard-table th,
  .service-dashboard-table td {
    padding: 0.5rem 0.35rem;
  }
  
  .service-dashboard-table .vin-cell {
    font-size: 0.7rem;
  }
}

/* Service Records Dashboard Page */
.dashboard-page {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  z-index: 1000;
  overflow-y: auto;
}

.dashboard-page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.dashboard-header h1 {
  margin: 0;
  font-size: 1.75rem;
  color: #1f2937;
}

.dashboard-subtitle {
  color: #6b7280;
  margin-bottom: 1.5rem;
  margin-left: 4.5rem;
}

.btn-back {
  background: #6b7280;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-back:hover {
  background: #4b5563;
}

/* Page-based table improvements */
.dashboard-page .service-dashboard-table-wrapper {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1rem;
}

.dashboard-page .service-dashboard-table {
  font-size: 0.95rem;
}

.dashboard-page .service-dashboard-table th {
  background: #f9fafb;
}

@media (max-width: 768px) {
  .dashboard-page-content {
    padding: 1rem;
  }
  
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .dashboard-header h1 {
    font-size: 1.3rem;
  }
  
  .dashboard-subtitle {
    margin-left: 0;
  }
}

/* Edit Service Record Modal */
#editServiceRecordModal .modal-content {
  max-width: 500px;
}

#editServiceRecordModal .form-group {
  margin-bottom: 1rem;
}

#editServiceRecordModal label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

#editServiceRecordModal input,
#editServiceRecordModal textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9rem;
}

#editServiceRecordModal textarea {
  resize: vertical;
  min-height: 60px;
}

/* Edit button in dashboard table */
.btn-edit-doc-table {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-edit-doc-table:hover {
  background: #d97706;
}
