/**
 * Carrookie Promotions Manager - Frontend Styles
 * Matches the design from the provided images
 */

/* Reset and Base Styles */
.carrookie-promotions-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Filter Section Styles */
.carrookie-filters-section {
  margin-bottom: 30px;
}

.carrookie-filter-toggle {
  background: #007bff;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.carrookie-filter-toggle:hover {
  background: #0056b3;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.carrookie-filters-panel {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.carrookie-filters-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
}

/* Filter Pills */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  background: white;
  border: 1px solid #dee2e6;
  color: #495057;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.filter-pill:hover {
  background: #e9ecef;
}

.filter-pill.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

/* Filter Dropdowns */
.filter-dropdown {
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.filter-dropdown:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Filter Range Inputs */
.filter-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-input {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  width: 80px;
  text-align: center;
}

.filter-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Filter Slider */
.filter-slider {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-slider-input {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #dee2e6;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.filter-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #007bff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.filter-slider-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #007bff;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.filter-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6c757d;
}

/* Filter Actions */
.filter-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.button {
  padding: 10px 20px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: white;
  color: #495057;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.button:hover {
  background: #e9ecef;
}

.button-secondary {
  background: #6c757d;
  color: white;
  border-color: #6c757d;
}

.button-secondary:hover {
  background: #5a6268;
}

/* Promotions Grid */
.carrookie-promotions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
  margin-top: 30px;
}

/* Promotion Card */
.carrookie-promotion-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e9ecef;
}

.carrookie-promotion-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.promotion-content {
  display: flex;
  flex-direction: column;
  padding: 25px;
  gap: 20px;
}

.promotion-header {
  display: flex;
}

.promotion-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.promotion-brand {
  font-size: 18px;
  font-weight: 700;
  color: #212529;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.promotion-deal {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.deal-headline {
  font-size: 28px;
  font-weight: 700;
  color: #007bff;
  line-height: 1.2;
}

.deal-details {
  font-size: 16px;
  color: #6c757d;
  font-weight: 500;
}

.promotion-actions {
  margin-top: auto;
}

.more-details-link {
  color: #007bff;
  text-decoration: underline;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.3s ease;
}

.more-details-link:hover {
  color: #0056b3;
}

.promotion-image {
  flex: 0 0 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
}

.car-image {
  width: 100%;
  height: auto;
  max-height: 150px;
  object-fit: cover;
  border-radius: 6px;
}

.no-image {
  color: #6c757d;
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.promotion-footer {
  padding: 20px 25px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  text-align: right;
}

.reserve-button {
  background: #007bff;
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  display: inline-block;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.reserve-button:hover {
  background: #0056b3;
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.more-details-content {
  color: #495057;
  line-height: 1.6;
}

.more-details-content h1,
.more-details-content h2,
.more-details-content h3,
.more-details-content h4,
.more-details-content h5,
.more-details-content h6 {
  color: #212529;
  margin-top: 0;
  margin-bottom: 15px;
}

.more-details-content p {
  margin-bottom: 15px;
}

.more-details-content ul,
.more-details-content ol {
  margin-bottom: 15px;
  padding-left: 20px;
}

/* Specifications Details */
.specifications-details {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  flex-direction: column;
}

.spec-section {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
}

.spec-section h4 {
  margin: 0 0 15px 0;
  color: #212529;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
}

.spec-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f8f9fa;
}

.spec-item:nth-child(odd) {
  border-right: 1px solid #f8f9fa;
  padding-right: 15px;
}

.spec-item:nth-child(even) {
  padding-left: 15px;
}

.spec-item:last-child,
.spec-item:nth-last-child(2):nth-child(odd) {
  border-bottom: none;
}

.spec-label {
  font-weight: 500;
  color: #495057;
  font-size: 14px;
}

.spec-value {
  font-weight: 600;
  color: #212529;
  font-size: 14px;
}

.additional-details {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid #e9ecef;
}

.additional-details h4 {
  margin: 0 0 15px 0;
  color: #212529;
  font-size: 16px;
  font-weight: 600;
}

.details-content {
  color: #495057;
  line-height: 1.6;
}

/* Responsive specifications */
@media (max-width: 768px) {
  .specifications-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .spec-section {
    padding: 15px;
  }

  .spec-details {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .spec-item:nth-child(odd),
  .spec-item:nth-child(even) {
    border-right: none;
    padding-right: 0;
    padding-left: 0;
  }

  .spec-value {
    font-weight: 500;
  }
}

/* Loading and No Results */
.carrookie-promotions-loading,
.carrookie-promotions-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
  font-size: 16px;
}

.carrookie-promotions-loading {
  background: #f8f9fa;
  border-radius: 8px;
  margin: 20px 0;
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

/*.spinner {*/
/*  width: 40px;*/
/*  height: 40px;*/
/*  border: 4px solid #e9ecef;*/
/*  border-top: 4px solid #007bff;*/
/*  border-radius: 50%;*/
/*  animation: rotate 1s linear infinite;*/
/*}*/

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    border: 3px solid;
    border-color: #939393 #939393 transparent transparent;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
.spinner::after,
.spinner::before {
    content: '';
    box-sizing: border-box;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    border: 3px solid;
    border-color: transparent transparent #007bff #007bff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    animation: rotationBack 0.5s linear infinite;
    transform-origin: center center;
}
.spinner::before {
    width: 32px;
    height: 32px;
    border-color: #939393 #939393 transparent transparent;
    animation: rotation 1.5s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes rotationBack {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

.loading-spinner p {
  margin: 0;
  font-weight: 500;
  color: #495057;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .carrookie-promotions-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
  }

  .filter-row {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .promotion-content {
    flex-direction: column;
    text-align: center;
  }

  .promotion-image {
    flex: none;
    max-width: 200px;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .carrookie-promotions-container {
    padding: 15px;
  }

  .carrookie-promotions-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .filter-pills {
    justify-content: center;
  }

  .filter-range {
    justify-content: center;
  }

  .promotion-content {
    padding: 20px;
    gap: 15px;
  }

  .deal-headline {
    font-size: 24px;
  }

  .promotion-brand {
    font-size: 16px;
  }

  .carrookie-filters-panel {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .carrookie-promotions-container {
    padding: 10px;
  }

  .promotion-content {
    padding: 15px;
  }

  .deal-headline {
    font-size: 20px;
  }

  .deal-details {
    font-size: 14px;
  }

  .reserve-button {
    padding: 10px 20px;
    font-size: 13px;
  }

  .carrookie-filters-panel {
    padding: 15px;
  }

  .filter-group {
    gap: 6px;
  }

  .filter-input {
    width: 70px;
    font-size: 13px;
  }
}

/* Animation for filter panel */
.carrookie-filters-panel {
  display: block;
  overflow: hidden;
}

/* Focus states for accessibility */
.filter-pill:focus,
.filter-dropdown:focus,
.filter-input:focus,
.reserve-button:focus,
.more-details-link:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .carrookie-promotion-card {
    border: 2px solid #000;
  }

  .filter-pill.active {
    border: 2px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .carrookie-promotion-card,
  .filter-pill,
  .reserve-button,
  .carrookie-filter-toggle {
    transition: none;
  }

  .carrookie-filters-panel {
    transition: none;
  }
}
