/* ============================================
   TOWNCRAFT — Cart Slide Panel
   ブランドサイトのウォームベージュ配色に合わせたカートUI
   ============================================ */

/* Overlay */
.tc-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 40, 32, 0.3);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tc-cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Side Panel */
.tc-cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: #f5f0e8;
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  font-family: 'Helvetica Neue', Helvetica, Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
  color: #3c3530;
}
.tc-cart-panel.active {
  transform: translateX(0);
}

/* Header */
.tc-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #d6d0c6;
  flex-shrink: 0;
}
.tc-cart-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.tc-cart-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #8a8278;
  padding: 4px;
  transition: color 0.2s;
  line-height: 1;
}
.tc-cart-close:hover {
  color: #3c3530;
}
.tc-cart-close svg {
  width: 18px;
  height: 18px;
}

/* Items */
.tc-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.tc-cart-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #d6d0c6;
}
.tc-cart-item-img {
  width: 80px;
  height: 100px;
  object-fit: cover;
  background: #ebe5db;
}
.tc-cart-item-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tc-cart-item-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.4;
}
.tc-cart-item-variant {
  font-size: 11px;
  color: #8a8278;
  margin-top: 4px;
}
.tc-cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tc-cart-item-price {
  font-size: 12px;
  letter-spacing: 0.05em;
}

/* Quantity */
.tc-cart-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #d6d0c6;
}
.tc-cart-qty button {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  font-size: 14px;
  color: #8a8278;
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tc-cart-qty button:hover {
  color: #3c3530;
}
.tc-cart-qty span {
  font-size: 11px;
  min-width: 24px;
  text-align: center;
  border-left: 1px solid #d6d0c6;
  border-right: 1px solid #d6d0c6;
  line-height: 28px;
}

/* Remove */
.tc-cart-item-remove {
  background: none;
  border: none;
  font-size: 10px;
  color: #b0a89e;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  margin-top: 6px;
  transition: color 0.2s;
}
.tc-cart-item-remove:hover {
  color: #3c3530;
}

/* Empty state */
.tc-cart-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #8a8278;
  font-size: 12px;
  letter-spacing: 0.1em;
  gap: 12px;
}
.tc-cart-empty svg {
  width: 32px;
  height: 32px;
  stroke: #b0a89e;
}

/* Footer */
.tc-cart-footer {
  border-top: 1px solid #d6d0c6;
  padding: 20px 24px;
  flex-shrink: 0;
}
.tc-cart-subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.tc-cart-subtotal-amount {
  font-weight: 600;
}
.tc-cart-tax-note {
  font-size: 10px;
  color: #8a8278;
  margin-bottom: 16px;
}
.tc-cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: #3c3530;
  color: #f5f0e8;
  border: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
  text-align: center;
}
.tc-cart-checkout-btn:hover {
  background: #2c2820;
}
.tc-cart-checkout-btn:disabled {
  background: #b0a89e;
  cursor: not-allowed;
}
.tc-cart-continue {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 12px;
  font-size: 11px;
  color: #8a8278;
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.tc-cart-continue:hover {
  color: #3c3530;
}

/* Badge on cart icon */
.tc-cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: #3c3530;
  color: #f5f0e8;
  font-size: 9px;
  font-weight: 600;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}
.tc-cart-badge:empty,
.tc-cart-badge[data-count="0"] {
  display: none;
}

/* Loading state */
.tc-cart-loading {
  position: absolute;
  inset: 0;
  background: rgba(245, 240, 232, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.tc-cart-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #d6d0c6;
  border-top-color: #3c3530;
  border-radius: 50%;
  animation: tcCartSpin 0.6s linear infinite;
}
@keyframes tcCartSpin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Newsletter Signup
   ============================================ */
.tc-newsletter {
  text-align: center;
  padding: 48px 40px;
  border-top: 1px solid #d6d0c6;
}
.tc-newsletter-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #3c3530;
  margin-bottom: 8px;
}
.tc-newsletter-desc {
  font-size: 11px;
  color: #8a8278;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}
.tc-newsletter-form {
  display: flex;
  justify-content: center;
  gap: 0;
  max-width: 420px;
  margin: 0 auto;
}
.tc-newsletter-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d6d0c6;
  border-right: none;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: #3c3530;
  letter-spacing: 0.03em;
  outline: none;
  transition: border-color 0.2s;
}
.tc-newsletter-input::placeholder {
  color: #b0a89e;
}
.tc-newsletter-input:focus {
  border-color: #8a8278;
}
.tc-newsletter-btn {
  padding: 10px 20px;
  background: #3c3530;
  color: #f5f0e8;
  border: 1px solid #3c3530;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.tc-newsletter-btn:hover {
  background: #2c2820;
  border-color: #2c2820;
}
.tc-newsletter-btn:disabled {
  background: #b0a89e;
  border-color: #b0a89e;
  cursor: not-allowed;
}
.tc-newsletter-msg {
  font-size: 11px;
  margin-top: 12px;
  letter-spacing: 0.05em;
}
.tc-newsletter-msg.success {
  color: #3c3530;
}
.tc-newsletter-msg.error {
  color: #a05a2c;
}

/* Responsive */
@media (max-width: 480px) {
  .tc-cart-panel {
    width: 100vw;
    max-width: 100vw;
  }
  .tc-cart-item {
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 16px 20px;
  }
  .tc-cart-item-img {
    width: 64px;
    height: 80px;
  }
  .tc-cart-header,
  .tc-cart-footer {
    padding: 16px 20px;
  }
  .tc-newsletter {
    padding: 36px 20px;
  }
  .tc-newsletter-form {
    flex-direction: column;
    gap: 8px;
  }
  .tc-newsletter-input {
    border-right: 1px solid #d6d0c6;
  }
  .tc-newsletter-btn {
    padding: 12px;
  }
}
