/* ================================================================
   Plugin Giỏ Hàng Tùy Chỉnh – Style
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --pgh-primary: #1a73e8;
  --pgh-primary-dark: #1558b0;
  --pgh-accent: #00b894;
  --pgh-danger: #e53935;
  --pgh-warning: #f6c90e;
  --pgh-bg: #f4f6fb;
  --pgh-card-bg: #ffffff;
  --pgh-border: #e8eaf0;
  --pgh-text: #2d3748;
  --pgh-text-light: #718096;
  --pgh-shadow: 0 4px 24px rgba(26, 115, 232, .10);
  --pgh-radius: 14px;
  --pgh-radius-sm: 8px;
  --pgh-transition: all .22s cubic-bezier(.4, 0, .2, 1);
}

/* ── Cart icon (header) ──────────────────────────────────────── */
.pgh-cart-icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 22px;
  text-decoration: none;
  color: var(--pgh-text);
  padding: 6px;
  border-radius: 50%;
  transition: var(--pgh-transition);
}

.pgh-cart-icon-link:hover {
  background: rgba(26, 115, 232, .1);
}

.pgh-cart-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--pgh-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  transition: var(--pgh-transition);
  animation: pgh-pop .3s ease;
}

.pgh-cart-badge-hidden {
  display: none !important;
}

/* ── Add-to-cart button (product pages / loop) ───────────────── */
.pgh-add-to-cart-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.pgh-add-to-cart-btn {
  font-size: 15px;
  font-weight: 600;
  padding: 13px 28px;
  border: none;
  border-radius: var(--pgh-radius-sm);
  cursor: pointer;
  background: linear-gradient(135deg, var(--pgh-primary), #3d8ef8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--pgh-transition);
  box-shadow: 0 4px 14px rgba(26, 115, 232, .30);
  position: relative;
  overflow: hidden;
}

.pgh-add-to-cart-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  transition: opacity .18s;
}

.pgh-add-to-cart-btn:hover::after {
  opacity: .08;
}

.pgh-add-to-cart-btn:active::after {
  opacity: .18;
}

.pgh-add-to-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(26, 115, 232, .38);
}

.pgh-add-to-cart-btn.pgh-in-cart {
  background: linear-gradient(135deg, var(--pgh-accent), #00cba9);
  box-shadow: 0 4px 14px rgba(0, 184, 148, .30);
}

.pgh-add-to-cart-btn.pgh-in-cart:hover {
  box-shadow: 0 8px 22px rgba(0, 184, 148, .38);
}

.pgh-check {
  font-style: normal;
}

.pgh-view-cart-link {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--pgh-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--pgh-primary);
  border-radius: var(--pgh-radius-sm);
  transition: var(--pgh-transition);
}

.pgh-view-cart-link:hover {
  background: var(--pgh-primary);
  color: #fff;
}

.pgh-cart-count {
  background: var(--pgh-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

/* ── Cart page wrapper ───────────────────────────────────────── */
#pgh-cart-page {
  font-family: 'Inter', sans-serif;
  color: var(--pgh-text);
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 0;
}

/* ── Empty cart ──────────────────────────────────────────────── */
.pgh-empty-cart {
  text-align: center;
  padding: 80px 24px;
  background: var(--pgh-card-bg);
  border-radius: var(--pgh-radius);
  box-shadow: var(--pgh-shadow);
}

.pgh-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pgh-float 3s ease-in-out infinite;
}

.pgh-empty-cart h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
}

.pgh-empty-cart p {
  color: var(--pgh-text-light);
  margin-bottom: 28px;
}

/* ── Two-column layout ───────────────────────────────────────── */
.pgh-cart-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 28px;
  align-items: start;
}

/* ── Section card ────────────────────────────────────────────── */
.pgh-cart-items-section,
.pgh-inquiry-form-section {
  background: var(--pgh-card-bg);
  border-radius: var(--pgh-radius);
  box-shadow: var(--pgh-shadow);
  padding: 28px;
}

.pgh-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--pgh-border);
}

.pgh-section-header h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--pgh-text);
}

.pgh-item-count {
  background: var(--pgh-bg);
  color: var(--pgh-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
}

/* ── Cart items list ─────────────────────────────────────────── */
.pgh-cart-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--pgh-border);
  transition: var(--pgh-transition);
  animation: pgh-slide-in .3s ease;
}

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

.pgh-item-thumb {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: var(--pgh-radius-sm);
  overflow: hidden;
  background: var(--pgh-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pgh-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.pgh-cart-item:hover .pgh-item-thumb img {
  transform: scale(1.06);
}

.pgh-no-thumb {
  font-size: 32px;
}

.pgh-item-info {
  flex: 1;
  min-width: 0;
}

.pgh-item-name {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pgh-item-name a {
  color: var(--pgh-text);
  text-decoration: none;
  transition: color .2s;
}

.pgh-item-name a:hover {
  color: var(--pgh-primary);
}

.pgh-item-qty-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--pgh-text-light);
}

.pgh-qty-control {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--pgh-border);
  border-radius: var(--pgh-radius-sm);
  overflow: hidden;
}

.pgh-qty-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--pgh-bg);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: var(--pgh-primary);
  transition: var(--pgh-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pgh-qty-btn:hover {
  background: var(--pgh-primary);
  color: #fff;
}

.pgh-qty-input {
  width: 44px;
  text-align: center;
  border: none;
  border-left: 1.5px solid var(--pgh-border);
  border-right: 1.5px solid var(--pgh-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--pgh-text);
  padding: 0;
  height: 30px;
  background: #fff;
}

.pgh-qty-input:focus {
  outline: none;
}

.pgh-remove-item {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--pgh-text-light);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--pgh-transition);
}

.pgh-remove-item:hover {
  background: #fff0f0;
  color: var(--pgh-danger);
  transform: rotate(90deg);
}

/* ── Cart actions ────────────────────────────────────────────── */
.pgh-cart-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--pgh-border);
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.pgh-btn-primary {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--pgh-primary), #3d8ef8);
  color: #fff;
  border: none;
  border-radius: var(--pgh-radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--pgh-transition);
  box-shadow: 0 4px 14px rgba(26, 115, 232, .28);
}

.pgh-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(26, 115, 232, .38);
  color: #fff;
  text-decoration: none;
}

.pgh-btn-secondary {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  background: transparent;
  color: var(--pgh-primary);
  border: 2px solid var(--pgh-border);
  border-radius: var(--pgh-radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--pgh-transition);
}

.pgh-btn-secondary:hover {
  border-color: var(--pgh-primary);
  background: rgba(26, 115, 232, .05);
  color: var(--pgh-primary);
  text-decoration: none;
}

.pgh-btn-danger {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  background: transparent;
  color: var(--pgh-danger);
  border: 1.5px solid rgba(229, 57, 53, .3);
  border-radius: var(--pgh-radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--pgh-transition);
}

.pgh-btn-danger:hover {
  background: var(--pgh-danger);
  color: #fff;
  border-color: var(--pgh-danger);
}

.pgh-btn-full {
  width: 100%;
  justify-content: center;
  padding: 15px;
  font-size: 15px;
}

/* ── Inquiry form ────────────────────────────────────────────── */
.pgh-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.pgh-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pgh-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--pgh-text);
}

.pgh-required {
  color: var(--pgh-danger);
  margin-left: 2px;
}

.pgh-form-group input,
.pgh-form-group textarea {
  font-size: 14px;
  color: var(--pgh-text);
  padding: 6px 14px;
  border: 1.5px solid var(--pgh-border);
  border-radius: var(--pgh-radius-sm);
  background: var(--pgh-bg);
  transition: var(--pgh-transition);
  resize: vertical;
  line-height: 30px;
}

.pgh-form-group input:focus,
.pgh-form-group textarea:focus {
  outline: none;
  border-color: var(--pgh-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .12);
}

.pgh-form-group input::placeholder,
.pgh-form-group textarea::placeholder {
  color: #b0b8c9;
}

.pgh-form-group input.pgh-error {
  border-color: var(--pgh-danger);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, .12);
}

/* ── Form message ─────────────────────────────────────────────── */
#pgh-form-message {
  padding: 0;
  border-radius: var(--pgh-radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: none;
  margin-bottom: 4px;
}

#pgh-form-message.pgh-success {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: #e8f5e9;
  border-left: 4px solid var(--pgh-accent);
  color: #1b5e20;
}

#pgh-form-message.pgh-error-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: #fff3f3;
  border-left: 4px solid var(--pgh-danger);
  color: #b71c1c;
}

/* ── Spinner ─────────────────────────────────────────────────── */
.pgh-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: pgh-spin .7s linear infinite;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes pgh-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pgh-pop {
  0% {
    transform: scale(.5);
    opacity: 0;
  }

  70% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pgh-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes pgh-slide-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pgh-fade-out {
  to {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
  }
}

.pgh-removing {
  animation: pgh-fade-out .3s ease forwards;
  pointer-events: none;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pgh-cart-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .pgh-form-row {
    grid-template-columns: 1fr;
  }

  .pgh-cart-actions {
    flex-direction: column;
  }

  .pgh-btn-secondary,
  .pgh-btn-danger {
    width: 100%;
    justify-content: center;
  }
}