/* webroot/css/cart.css */

/* ======================
   Variables & Base Styles
   ====================== */
:root {
  /* Color Palette */
  --primary-color: #0d6efd;
  --primary-hover: #0b5ed7;
  --danger-color: #dc3545;
  --danger-hover: #bb2d3b;
  --muted-color: #6c757d;
  --border-color: #dee2e6;
  --bg-color: #fff;
  --body-bg: #f8f9fa;
  --text-color: #212529;
  
  /* Typography */
  --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --base-font-size: 1rem;
  --line-height: 1.5;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  
  /* Transitions */
  --transition: all 0.15s ease-in-out;
}

/* Base Styles */
body {
  font-family: var(--font-family);
  font-size: var(--base-font-size);
  line-height: var(--line-height);
  color: var(--text-color);
  background-color: var(--body-bg);
}

/* ======================
   Layout & Structure
   ====================== */
.cart-container {
  max-width: 1580px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-sm);
}

.cart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  
  @media (min-width: 992px) {
    grid-template-columns: repeat(3, 1fr);
    
    .cart-items-column {
      grid-column: span 2;
    }
    
    .cart-summary-column {
      grid-column: span 1;
    }
  }
}

/* ======================
   Typography
   ====================== */
.cart-title {
  font-size: clamp(2rem, 5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-xs);
}

.cart-subtitle {
  color: var(--muted-color);
  font-size: clamp(2rem, 3vw, 1.25rem);
  margin-top: var(--space-xs);
}

/* ======================
   Card Components
   ====================== */
.cart-card {
  background: linear-gradient(135deg, #f9f6ff 80%, #f5f2ff 100%);
  box-shadow: 0 4px 24px rgba(123, 47, 247, 0.13);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.cart-card:hover {
  box-shadow: 0 8px 32px rgba(123, 47, 247, 0.18);
}

.cart-card-header,
.cart-card-body,
.cart-card-footer {
  padding: var(--space-lg);
}

/* Card Title - purple and bold */
.cart-card-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  margin: 0;
  color: #7B2FF7;
  font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}
/* ======================
   Cart Items Table
   ====================== */
.cart-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  
  th, td {
    padding: var(--space-md);
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: clamp(1.25rem, 2vw, 1.45rem);
  }
}

.cart-table-header {
  font-weight: 600;
  color: #7B2FF7;
  background-color: #f5f2ff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: clamp(1.3rem, 2vw, 1.4rem);
}

/* Table Columns */
.item-col { width: 55%; min-width: 200px; }
.price-col, .total-col { width: 12%; }
.quantity-col { width: 10%; }
.actions-col { width: 11%; text-align: center; }

/* Item Details */
.cart-table td.actions-cell {
  text-align: center;
}

.item-details {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.item-image-placeholder {
  flex: 0 0 4rem;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background-color: #e9ecef;
  display: grid;
  place-items: center;
  font-weight: bold;
  color: var(--muted-color);
}

.item-title {
  font-weight: 500;
  font-size: clamp(1.3rem, 2.5vw, 1.5rem);
}

.item-title-link {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
  
  &:hover {
    text-decoration: underline;
    color: var(--primary-color);
  }
}

.item-type {
  font-size: clamp(1.5rem, 2vw, 1.3rem);
  color: var(--muted-color);
  margin-top: var(--space-xs);
}

/* ======================
   Summary Section
   ====================== */
.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  padding: var(--space-xs) 0;
}

.summary-separator {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-sm) 0;
}

.summary-total {
  font-weight: 700;
  font-size: clamp(1.3rem, 2.5vw, 1.5rem);
}

/* ======================
   Buttons (PURPLE STYLE)
   ====================== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: 1px solid transparent;
  font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.button-primary {
  background-color: #7B2FF7;
  color: #fff;
  border: none;
}
.button-primary:hover,
.button-primary:focus {
  background-color: #5F19C4;
  color: #fff;
}

.button-danger {
  background-color: transparent;
  color: #dc3545;
  border: 2px solid #dc3545;
}
.button-danger:hover,
.button-danger:focus {
  background-color: #dc3545;
  color: #fff;
}

.button-full-width {
  width: 100%;
}

/* Remove-item button (danger style, purple border on hover) */
.remove-item-button {
  color: #dc3545;
  background: none;
  border: 2px solid #dc3545;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.remove-item-button:hover,
.remove-item-button:focus {
  background-color: #dc3545;
  color: #fff;
}



/* ======================
   Empty State
   ====================== */
.cart-empty-message {
  padding: var(--space-sm);
  background-color: #cfe2ff;
  border: 1px solid #b6d4fe;
  color: #084298;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: clamp(1rem, 2vw, 1.25rem);
}

/* ======================
   Responsive Adjustments
   ====================== */
@media (max-width: 768px) {
  .cart-table {
    min-width: 100%;
    
    thead {
      @media (max-width: 768px) {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }
    }
    
    tr {
      display: block;
      margin-bottom: var(--space-lg);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-sm);
      background-color: var(--bg-color);
    }
    
    td {
      display: block;
      text-align: right;
      padding: var(--space-sm);
      border-bottom: 1px dashed var(--border-color);
      
      &::before {
        content: attr(data-label);
        float: left;
        font-weight: 500;
        color: var(--muted-color);
        text-transform: capitalize;
      }
      
      &:last-child {
        border-bottom: none;
      }
    }
    
    .item-cell {
      text-align: left;
      display: flex;
      gap: var(--space-sm);
      
      &::before {
        display: none;
      }
    }
    
    .actions-cell {
      text-align: center;
      
      &::before {
        display: none;
      }
    }
  }
  
  .item-image-placeholder {
    flex: 0 0 3.5rem;
  }
}

/* ======================
   Utility Classes
   ====================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.visually-hidden { @extend .sr-only; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}