/**
 * Cart Page Styles
 * Surprise Granite - Professional E-commerce Cart
 * Matches checkout.css styling
 */

:root {
  --cart-bg: #f5f5f7;
  --card-bg: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #6e6e73;
  --border-color: #d2d2d7;
  --border-light: #e8e8ed;
  --gold: #f9cb00;
  --gold-hover: #e5b800;
  --gold-light: rgba(249, 203, 0, 0.1);
  --success: #34c759;
  --success-bg: rgba(52, 199, 89, 0.1);
  --error: #ff3b30;
  --error-bg: rgba(255, 59, 48, 0.1);
  --blue: #007aff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', sans-serif;
  background: var(--cart-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Cart Page Layout */
.cart-page {
  min-height: calc(100vh - 200px);
  padding: 40px 24px;
  padding-top: calc(var(--unified-nav-height, 120px) + 40px);
}

.cart-container {
  max-width: 1120px;
  margin: 0 auto;
}

/* Cart Header */
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.cart-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin: 0;
}

.continue-shopping {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.continue-shopping:hover {
  opacity: 0.8;
}

.continue-shopping svg {
  width: 16px;
  height: 16px;
}

/* Cart Content Grid */
.cart-content {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: start;
}

/* Cart Items Section */
.cart-items-section {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Empty Cart */
.cart-empty {
  padding: 80px 40px;
  text-align: center;
}

.cart-empty svg {
  margin-bottom: 24px;
  color: var(--border-color);
}

.cart-empty h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-primary);
}

.cart-empty p {
  color: var(--text-secondary);
  margin: 0 0 28px;
  font-size: 15px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-hover) 100%);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(249, 203, 0, 0.3);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 203, 0, 0.4);
}

/* Cart Items List */
.cart-items {
  padding: 0;
}

.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
  transition: background 0.2s;
}

.cart-item:hover {
  background: rgba(0, 0, 0, 0.01);
}

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

.cart-item-image {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
  flex-shrink: 0;
}

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

.cart-item:hover .cart-item-image img {
  transform: scale(1.05);
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-decoration: none;
  display: block;
  transition: color 0.2s;
}

.cart-item-name:hover {
  color: var(--blue);
}

.cart-item-variant {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.cart-item-price {
  font-size: 14px;
  color: var(--text-tertiary);
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
}

.cart-item-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Quantity Selector */
.quantity-selector {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card-bg);
}

.quantity-btn {
  width: 36px;
  height: 36px;
  background: var(--cart-bg);
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-primary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-btn:hover {
  background: var(--border-light);
}

.quantity-btn:active {
  background: var(--border-color);
}

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

.quantity-value {
  width: 48px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  border: none;
  background: var(--card-bg);
  color: var(--text-primary);
}

/* Remove Button */
.remove-item {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  font-weight: 500;
}

.remove-item:hover {
  color: var(--error);
  background: var(--error-bg);
}

/* Cart Summary */
.cart-summary {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 28px;
  position: sticky;
  top: calc(var(--unified-nav-height, 120px) + 20px);
}

.cart-summary h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: -0.2px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 14px;
}

.summary-row span:first-child {
  color: var(--text-secondary);
}

.summary-row.total {
  font-size: 18px;
  font-weight: 700;
  padding: 16px 0 0;
}

.summary-row.total span:first-child {
  color: var(--text-primary);
}

.summary-divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

/* Promo Code */
.promo-section {
  margin: 20px 0;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.promo-input {
  display: flex;
  gap: 8px;
}

.promo-input input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.promo-input input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-light);
}

.promo-input button {
  padding: 12px 20px;
  background: var(--text-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.promo-input button:hover {
  background: #333;
}

.promo-message {
  font-size: 13px;
  margin-top: 10px;
}

.promo-message.success {
  color: var(--success);
}

.promo-message.error {
  color: var(--error);
}

/* Account Signup Prompt */
.account-prompt {
  background: linear-gradient(135deg, var(--gold-light) 0%, rgba(249, 203, 0, 0.03) 100%);
  border: 1px solid rgba(249, 203, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.account-prompt-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.account-prompt-header svg {
  color: #b8860b;
  flex-shrink: 0;
}

.account-prompt > p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 14px;
}

.account-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}

.account-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  padding: 6px 0;
}

.account-benefits li svg {
  flex-shrink: 0;
}

.account-prompt-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.btn-signin,
.btn-create {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-signin {
  background: var(--text-primary);
  color: #fff;
}

.btn-signin:hover {
  background: #333;
}

.btn-create {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-hover) 100%);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(249, 203, 0, 0.25);
}

.btn-create:hover {
  box-shadow: 0 4px 12px rgba(249, 203, 0, 0.35);
}

.guest-note {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

.guest-link {
  background: none;
  border: none;
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: inherit;
  transition: opacity 0.2s;
}

.guest-link:hover {
  opacity: 0.8;
}

/* Hide prompt when logged in */
body.user-logged-in .account-prompt {
  display: none;
}

/* Checkout Button */
.btn-checkout {
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-hover) 100%);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(249, 203, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  margin-top: 24px;
}

.btn-checkout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 203, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-checkout:active {
  transform: translateY(0);
}

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

.btn-checkout.loading {
  pointer-events: none;
}

.btn-checkout.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Security Badge */
.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.security-badge svg {
  flex-shrink: 0;
}

/* Payment Methods */
.payment-methods {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.payment-methods img {
  height: 24px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.payment-methods img:hover {
  opacity: 1;
}

/* Recently Viewed */
.recently-viewed {
  margin-top: 60px;
}

.recently-viewed h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}

.recently-viewed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.recent-item {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.recent-item:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.recent-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  transition: transform 0.3s;
}

.recent-item:hover img {
  transform: scale(1.05);
}

.recent-item-info {
  padding: 16px;
}

.recent-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-item-price {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Footer */
.cart-footer {
  background: var(--text-primary);
  color: #fff;
  padding: 32px 24px;
  margin-top: 80px;
}

.footer-container {
  max-width: 1120px;
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #fff;
}

.footer-container p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

/* Mobile Responsive */
@media (max-width: 960px) {
  .cart-content {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .cart-summary {
    position: static;
    order: 2;
  }

  .cart-items-section {
    order: 1;
  }

  .recently-viewed-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .cart-page {
    padding: 20px 16px;
    padding-top: calc(var(--unified-nav-height, 120px) + 20px);
  }

  .cart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .cart-header h1 {
    font-size: 26px;
  }

  .cart-items-section,
  .cart-summary {
    border-radius: var(--radius-lg);
  }

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

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

  .cart-item-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--border-light);
  }

  .cart-summary {
    padding: 20px;
  }

  .account-prompt-actions {
    flex-direction: column;
  }

  .recently-viewed-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .footer-links {
    flex-direction: column;
    gap: 16px;
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease;
}

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

/* Cart Item Removal Animation */
.cart-item.removing {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-20px);
  }
}
