/*
 * CA Contractor Database Styles
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.4em;
  font-weight: 700;
  color: #667eea;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-link {
  color: #333;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background: #667eea;
  color: white;
}

/* Flash messages */
.flash {
  max-width: 1200px;
  margin: 0 auto 20px;
  padding: 15px 20px;
  border-radius: 8px;
  font-weight: 500;
}

.flash-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.header {
  text-align: center;
  color: #333;
  margin-bottom: 15px;
}

.header h1 {
  font-size: 1.8em;
  margin-bottom: 5px;
  color: #667eea;
}

.header p {
  font-size: 0.95em;
  color: #666;
}

/* Search container */
.search-container,
.upload-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

/* Instructions */
.instructions {
  background: #f7f7ff;
  border-left: 4px solid #667eea;
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 6px;
}

.instructions h3 {
  color: #667eea;
  margin-bottom: 12px;
  font-size: 1.1em;
}

.instructions p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 10px;
}

.instructions ul {
  color: #666;
  line-height: 1.8;
  margin-left: 20px;
}

/* Filters */
.filters-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.filters-section h4 {
  color: #333;
  margin-bottom: 8px;
  font-size: 0.9em;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-select {
  padding: 8px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.filter-select:focus {
  border-color: #667eea;
}

.filter-select-primary {
  font-size: 16px;
  font-weight: 600;
  padding: 10px 14px;
  min-width: 200px;
}

.filter-note {
  font-size: 0.85em;
  color: #666;
  margin-left: 10px;
}

.clear-filters-btn {
  background: #f0f0f0;
  color: #666;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.clear-filters-btn:hover {
  background: #e0e0e0;
}

.active-filter-badge {
  background: #667eea;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  margin-bottom: 8px;
}

.active-filter-badge .remove {
  cursor: pointer;
  font-weight: bold;
}

/* Search box */
.search-box {
  position: relative;
}

#searchInput {
  width: 100%;
  padding: 15px 20px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  outline: none;
  transition: all 0.3s ease;
}

#searchInput:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Autocomplete */
.autocomplete-items {
  position: absolute;
  background: white;
  border: 2px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 99;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
}

.autocomplete-items.active {
  display: block;
}

.autocomplete-item {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background-color: #f7f7ff;
}

/* Results */
.results-container {
  background: white;
  border-radius: 8px;
  padding: 15px 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: none;
}

.results-container.active {
  display: block;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

.results-count {
  color: #667eea;
  font-weight: 600;
  font-size: 1.1em;
}

.back-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
  display: none;
}

.back-btn:hover {
  background: #5568d3;
}

.back-btn.active {
  display: inline-block;
}

.results-list {
  display: grid;
  gap: 8px;
}

.result-item {
  padding: 10px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.result-item:hover {
  border-color: #667eea;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15);
}

.result-name {
  font-size: 1em;
  font-weight: 600;
  color: #333;
  margin-bottom: 3px;
}

.result-license {
  color: #667eea;
  font-weight: 500;
  font-size: 0.85em;
  margin-bottom: 2px;
}

.result-classes {
  color: #666;
  font-size: 0.8em;
}

/* Detail view */
.detail-view {
  display: none;
}

.detail-view.active {
  display: block;
}

.detail-header {
  background: #667eea;
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-header-content {
  flex: 1;
}

.detail-header h2 {
  font-size: 1.5em;
  margin-bottom: 5px;
}

.detail-header .license {
  font-size: 1em;
  opacity: 0.9;
}

.detail-section {
  margin-bottom: 30px;
}

.detail-section h3 {
  color: #667eea;
  font-size: 1.3em;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.detail-field {
  padding: 15px;
  background: #f7f7ff;
  border-radius: 6px;
}

.detail-field label {
  display: block;
  font-size: 0.85em;
  color: #666;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-field value {
  display: block;
  color: #333;
  font-weight: 500;
  font-size: 1.1em;
}

/* License status cards */
.license-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.license-status-card {
  background: #f7f7ff;
  padding: 15px;
  border-radius: 6px;
  border-left: 4px solid #667eea;
}

.license-status-card.inactive {
  border-left-color: #ef4444;
  background: #fef2f2;
}

/* Status badges */
.status-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 8px;
}

.status-badge.active {
  background: #10b981;
  color: white;
}

.status-badge.inactive {
  background: #ef4444;
  color: white;
}

/* Update button */
.update-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.3s ease;
  margin-top: 20px;
}

.update-btn:hover {
  background: #5568d3;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
  color: #667eea;
  margin: 0;
}

.close-modal {
  font-size: 28px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}

.close-modal:hover {
  color: #333;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #667eea;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 30px;
}

.btn-cancel {
  background: #f0f0f0;
  color: #666;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.btn-cancel:hover {
  background: #e0e0e0;
}

.btn-save,
.btn-upload {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.btn-save:hover,
.btn-upload:hover {
  background: #5568d3;
}

/* Upload specific */
.upload-form {
  background: #f7f7ff;
  padding: 30px;
  border-radius: 8px;
}

.file-input {
  width: 100%;
  padding: 20px;
  border: 2px dashed #667eea;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.file-note {
  font-size: 0.9em;
  color: #666;
  font-style: italic;
}

.btn-template {
  display: inline-block;
  background: #10b981;
  color: white;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.btn-template:hover {
  background: #059669;
}

/* Format sections for upload page */
.format-section {
  background: white;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  border: 1px solid #e0e0e0;
}

.format-section:last-child {
  margin-bottom: 0;
}

.format-section h4 {
  color: #667eea;
  font-size: 1em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.format-section p {
  margin-bottom: 8px;
}

.format-section ul {
  margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.5em;
  }

  .search-container,
  .results-container,
  .upload-container {
    padding: 12px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .nav-container {
    flex-direction: column;
    gap: 15px;
  }
}
