/**
 * OneStepOrder - Quick View Modal Styling
 * Product detail popup with image gallery
 * 
 * @package    WHMCS OneStepOrder Addon
 * @version    1.0.0
 * @updated    2025-10-31
 */

/* Modal Container */
.quick-view-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.3s ease-out;
}

.quick-view-modal.open {
  display: flex;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Overlay */
.quick-view-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

/* Modal Container */
.quick-view-container {
  position: relative;
  background-color: white;
  border-radius: 8px;
  max-width: 900px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 30px;
  animation: containerSlideIn 0.3s ease-out;
}

@keyframes containerSlideIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Close Button */
.quick-view-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background-color: #f0f0f0;
  border: none;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.quick-view-close:hover {
  background-color: #007bff;
  color: white;
}

/* Content Layout */
.quick-view-content {
  display: contents;
}

/* Gallery Section */
.quick-view-gallery {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.gallery-main {
  position: relative;
  background-color: #f8f9fa;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}

.qv-main-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  opacity: 0;
}

.qv-main-image.loaded {
  opacity: 1;
}

.gallery-main:hover .qv-main-image {
  transform: scale(1.05);
}

.gallery-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #dc3545;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

/* Thumbnails */
.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.thumb-item {
  width: 60px;
  height: 60px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.thumb-item:hover {
  border-color: #007bff;
}

.thumb-item.active {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Details Section */
.quick-view-details {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.qv-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qv-header h2 {
  margin: 0;
  font-size: 24px;
  color: #333;
  line-height: 1.3;
}

.qv-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.rating-stars {
  color: #ffc107;
}

.reviews-count {
  color: #666;
}

/* Pricing */
.qv-pricing {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.qv-price {
  font-size: 24px;
  font-weight: bold;
  color: #007bff;
}

.price-sale {
  color: #007bff;
}

.price-original {
  text-decoration: line-through;
  color: #999;
  font-size: 18px;
}

.qv-save-amount {
  font-size: 14px;
  color: #dc3545;
  font-weight: 600;
}

/* Description */
.qv-description {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

/* Features List */
.qv-features {
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  padding: 15px 0;
}

.features-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.features-list li {
  font-size: 14px;
  color: #555;
  padding-left: 20px;
  position: relative;
}

.features-list li:before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #28a745;
  font-weight: bold;
}

/* Options */
.qv-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.qv-option {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.qv-option label {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.qv-option-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  cursor: pointer;
}

.qv-option-select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* Quantity Section */
.qv-quantity-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qv-quantity-section label {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin: 0;
}

.quantity-input {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background-color: #f8f9fa;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.qty-btn:hover {
  background-color: #007bff;
  color: white;
}

.qv-quantity {
  width: 50px;
  height: 32px;
  border: none;
  text-align: center;
  font-size: 14px;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

.qv-quantity:focus {
  outline: none;
}

/* Add to Cart Button */
.qv-add-to-cart {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 4px;
  width: 100%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.qv-add-to-cart:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Additional Info */
.qv-additional-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background-color: #f8f9fa;
  border-radius: 4px;
  font-size: 14px;
}

.qv-stock-status,
.qv-shipping-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.in-stock {
  color: #28a745;
  font-weight: 600;
}

.out-of-stock {
  color: #dc3545;
  font-weight: 600;
}

/* View Details Link */
.qv-view-details-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  transition: all 0.2s ease;
}

.qv-view-details-link:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .quick-view-container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    max-height: 90vh;
  }

  .qv-header h2 {
    font-size: 20px;
  }

  .qv-price {
    font-size: 20px;
  }

  .gallery-thumbs {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .quick-view-container {
    width: 95%;
    padding: 15px;
    gap: 15px;
  }

  .quick-view-close {
    width: 32px;
    height: 32px;
    font-size: 24px;
  }

  .qv-header h2 {
    font-size: 18px;
  }

  .qv-price {
    font-size: 18px;
  }

  .gallery-main {
    aspect-ratio: 1 / 1;
  }

  .thumb-item {
    width: 50px;
    height: 50px;
  }

  .qv-quantity-section {
    flex-direction: column;
    align-items: stretch;
  }

  .qv-quantity-section label {
    order: -1;
  }

  .quantity-input {
    width: 100%;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .quick-view-container {
    background-color: #2c2c2c;
    color: #e0e0e0;
  }

  .qv-header h2 {
    color: #e0e0e0;
  }

  .qv-option label,
  .qv-quantity-section label {
    color: #e0e0e0;
  }

  .qv-description,
  .features-list li {
    color: #b0b0b0;
  }

  .gallery-main {
    background-color: #1a1a1a;
  }

  .thumb-item {
    border-color: #444;
  }

  .thumb-item:hover {
    border-color: #0056b3;
  }

  .qv-option-select,
  .qv-quantity {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border-color: #444;
  }

  .quantity-input {
    border-color: #444;
  }

  .qty-btn {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border-color: #444;
  }

  .qv-additional-info {
    background-color: #1a1a1a;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .quick-view-container {
    background-color: #1e1e1e;
    color: #e0e0e0;
  }

  .quick-view-modal.open {
    background-color: rgba(0, 0, 0, 0.8);
  }

  .quick-view-details {
    background-color: #242424;
  }

  .qv-header h2 {
    color: #f5f5f5;
  }

  .qv-description {
    color: #d0d0d0;
  }

  .qv-features ul li {
    color: #d0d0d0;
  }

  .qv-add-to-cart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
  }

  .quick-view-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

/* Print Styles */
@media print {
  .quick-view-modal {
    display: none !important;
  }
}
