/**
 * Customer Storefront Styles
 * Simple, clean e-commerce design
 */

/* ============================================================================
   Variables & Reset
   ============================================================================ */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --secondary-hover: #475569;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --border-color: #e2e8f0;
  --bg-light: #f8fafc;
  --white: #ffffff;
  --max-width: 1200px;
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-light);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ============================================================================
   Container & Layout
   ============================================================================ */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================================
   Header
   ============================================================================ */

.header {
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.tagline {
  font-size: 14px;
  color: var(--text-light);
}

.nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav a {
  font-weight: 500;
  color: var(--text-dark);
  transition: var(--transition);
}

.nav a:hover {
  color: var(--primary-color);
}

.cart-link {
  padding: 8px 16px;
  background-color: var(--primary-color);
  color: var(--white) !important;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.cart-link:hover {
  background-color: var(--primary-hover);
}

.cart-link.active {
  background-color: var(--primary-hover);
}

/* ============================================================================
   Hero Section
   ============================================================================ */

.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
  color: var(--white);
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
}

.hero p {
  font-size: 20px;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================================================
   Products Section
   ============================================================================ */

.products-section {
  padding: 60px 0;
}

.products-section h1 {
  font-size: 36px;
  margin-bottom: 40px;
  text-align: center;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.loading-message,
.error-message {
  text-align: center;
  padding: 40px;
  font-size: 18px;
}

.error-message {
  color: var(--danger-color);
  background-color: #fee;
  border-radius: var(--border-radius);
}

.no-products {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 18px;
}

/* ============================================================================
   Product Card
   ============================================================================ */

.product-card {
  background-color: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.product-card.out-of-stock {
  opacity: 0.6;
}

.product-image {
  position: relative;
  width: 100%;
  height: 280px;
  background-color: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-image {
  font-size: 64px;
  color: var(--text-light);
}

.stock-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: var(--danger-color);
  color: var(--white);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.product-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.product-description {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 16px;
  flex: 1;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--border-radius);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-size: 14px;
}

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
}

.btn-block {
  display: block;
  width: 100%;
  margin-bottom: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  font-size: 14px;
  text-decoration: underline;
  padding: 4px;
}

.btn-remove:hover {
  color: #dc2626;
}

/* ============================================================================
   Cart 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);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--white);
  border-radius: var(--border-radius);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 24px;
}

.modal-close {
  font-size: 32px;
  font-weight: 300;
  color: var(--text-light);
  cursor: pointer;
  border: none;
  background: none;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-dark);
}

.modal-body {
  padding: 24px;
}

.modal-product-image {
  width: 100%;
  height: 300px;
  background-color: var(--bg-light);
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-product-info h3 {
  font-size: 22px;
  margin-bottom: 12px;
}

.modal-product-info p {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 24px;
}

.quantity-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.quantity-selector label {
  font-weight: 600;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background-color: var(--white);
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  transition: var(--transition);
}

.qty-btn:hover {
  background-color: var(--bg-light);
}

#quantityInput {
  width: 60px;
  text-align: center;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
}

/* ============================================================================
   Cart Page
   ============================================================================ */

.cart-section {
  padding: 60px 0;
  min-height: 60vh;
}

.cart-section h1 {
  font-size: 36px;
  margin-bottom: 40px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state p {
  font-size: 20px;
  color: var(--text-light);
  margin-bottom: 24px;
}

.cart-items {
  margin-bottom: 40px;
}

.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr auto auto;
  gap: 20px;
  padding: 20px;
  background-color: var(--white);
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  align-items: center;
}

.cart-item-image {
  width: 100px;
  height: 100px;
  background-color: var(--bg-light);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.cart-item-details h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.cart-item-sku {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.cart-item-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-color);
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-display {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
}

.cart-item-total {
  text-align: right;
}

.cart-item-total p {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.cart-summary {
  background-color: var(--white);
  padding: 24px;
  border-radius: var(--border-radius);
  max-width: 400px;
  margin-left: auto;
}

.cart-summary h3 {
  font-size: 20px;
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 16px;
}

.summary-row.total {
  font-size: 20px;
  font-weight: 700;
  padding-top: 12px;
  border-top: 2px solid var(--border-color);
  margin-top: 12px;
}

/* ============================================================================
   Checkout Page
   ============================================================================ */

.checkout-section {
  padding: 60px 0;
}

.checkout-section h1 {
  font-size: 36px;
  margin-bottom: 40px;
}

.checkout-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
}

.checkout-form {
  background-color: var(--white);
  padding: 32px;
  border-radius: var(--border-radius);
}

.form-section {
  margin-bottom: 32px;
}

.form-section h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--text-dark);
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.order-summary {
  background-color: var(--white);
  padding: 24px;
  border-radius: var(--border-radius);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.order-summary h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

.order-items {
  margin-bottom: 20px;
}

.order-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.order-item:last-child {
  border-bottom: none;
}

.order-item-image {
  width: 60px;
  height: 60px;
  background-color: var(--bg-light);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.order-item-details {
  flex: 1;
}

.order-item-details h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.order-item-details p {
  font-size: 12px;
  color: var(--text-light);
}

.order-item-price {
  font-weight: 600;
  color: var(--primary-color);
}

.summary-totals {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--border-color);
}

.loading-message {
  background-color: #dbeafe;
  color: var(--primary-color);
  padding: 12px;
  border-radius: var(--border-radius);
  text-align: center;
  margin-bottom: 16px;
}

.error-message {
  margin-bottom: 16px;
}

/* ============================================================================
   Confirmation Page
   ============================================================================ */

.confirmation-section {
  padding: 60px 0;
  min-height: 60vh;
}

.confirmation-card {
  background-color: var(--white);
  border-radius: var(--border-radius);
  padding: 48px;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.confirmation-icon {
  font-size: 72px;
  margin-bottom: 24px;
}

.confirmation-card h1 {
  font-size: 36px;
  margin-bottom: 16px;
  color: var(--success-color);
}

.confirmation-message {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 40px;
}

.order-details {
  text-align: left;
  margin-bottom: 40px;
}

.order-details h2 {
  font-size: 24px;
  margin-bottom: 20px;
}

.order-details h3 {
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.order-info {
  background-color: var(--bg-light);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 24px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 16px;
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-row .label {
  font-weight: 600;
  color: var(--text-dark);
}

.info-row .value {
  color: var(--text-light);
}

.order-items-section {
  margin-bottom: 24px;
}

.confirmation-items {
  background-color: var(--bg-light);
  border-radius: var(--border-radius);
  padding: 16px;
}

.confirmation-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.confirmation-item:last-child {
  border-bottom: none;
}

.confirmation-item h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.confirmation-item p {
  font-size: 14px;
  color: var(--text-light);
}

.item-price {
  font-weight: 700;
  color: var(--primary-color);
}

.shipping-info,
.contact-info {
  background-color: var(--bg-light);
  padding: 16px;
  border-radius: var(--border-radius);
  margin-bottom: 16px;
}

.shipping-info p,
.contact-info p {
  margin-bottom: 4px;
  line-height: 1.6;
}

.confirmation-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ============================================================================
   About Section
   ============================================================================ */

.about-section {
  padding: 60px 0;
  background-color: var(--white);
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.about-content h2 {
  font-size: 32px;
  margin-bottom: 20px;
}

.about-content p {
  font-size: 18px;
  line-height: 1.8;
  color: var(--text-light);
}

/* ============================================================================
   Footer
   ============================================================================ */

.footer {
  background-color: var(--text-dark);
  color: var(--white);
  padding: 40px 0;
  margin-top: 60px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
  opacity: 0.7;
}

/* ============================================================================
   Toast Notification
   ============================================================================ */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--text-dark);
  color: var(--white);
  padding: 16px 24px;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .cart-item {
    grid-template-columns: 80px 1fr;
    gap: 12px;
  }

  .cart-item-image {
    width: 80px;
    height: 80px;
  }

  .cart-item-quantity,
  .cart-item-total {
    grid-column: 2;
  }

  .checkout-container {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }

  .confirmation-card {
    padding: 32px 20px;
  }

  .confirmation-actions {
    flex-direction: column;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header-content {
    flex-direction: column;
    gap: 16px;
  }

  .nav {
    gap: 16px;
  }
}
