/* =============================================================================
   ProTechTrader Modern Cart & Notification System
   Optimized for conversions, modern design, Shoppica2 theme compatible
   Created: 2026-01-10
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Variables - Theme Colors (matches Shoppica2)
   ----------------------------------------------------------------------------- */
:root {
  --ptt-primary: #e74c3c;
  --ptt-primary-hover: #c0392b;
  --ptt-secondary: #3498db;
  --ptt-secondary-hover: #2980b9;
  --ptt-success: #27ae60;
  --ptt-text: #2c3e50;
  --ptt-text-light: #7f8c8d;
  --ptt-border: #ecf0f1;
  --ptt-bg: #ffffff;
  --ptt-bg-hover: #f8f9fa;
  --ptt-shadow: 0 10px 40px rgba(0,0,0,0.15);
  --ptt-shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
  --ptt-radius: 8px;
  --ptt-radius-sm: 4px;
  --ptt-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -----------------------------------------------------------------------------
   Cart Dropdown Container
   ----------------------------------------------------------------------------- */
.ptt-cart-modern {
  width: 320px;
  max-height: 420px;
  background: var(--ptt-bg);
  border-radius: var(--ptt-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Items Container */
.ptt-cart-items {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  max-height: 250px;
}

/* Custom Scrollbar */
.ptt-cart-items::-webkit-scrollbar {
  width: 4px;
}
.ptt-cart-items::-webkit-scrollbar-track {
  background: transparent;
}
.ptt-cart-items::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}
.ptt-cart-items::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* -----------------------------------------------------------------------------
   Cart Item
   ----------------------------------------------------------------------------- */
.ptt-cart-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  position: relative;
  transition: var(--ptt-transition);
  border-bottom: 1px solid var(--ptt-border);
}

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

.ptt-cart-item:hover {
  background: var(--ptt-bg-hover);
}

/* Product Image */
.ptt-cart-item-image {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: var(--ptt-radius-sm);
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptt-cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--ptt-transition);
}

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

/* Voucher Icon */
.ptt-voucher-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ptt-primary);
  background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
}

/* Item Details */
.ptt-cart-item-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ptt-cart-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ptt-text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  transition: var(--ptt-transition);
}

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

.ptt-cart-item-option {
  font-size: 11px;
  color: var(--ptt-text-light);
  display: block;
}

.ptt-cart-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.ptt-cart-item-qty {
  font-size: 12px;
  color: var(--ptt-text-light);
}

.ptt-cart-item-qty strong {
  color: var(--ptt-text);
}

.ptt-cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--ptt-primary);
}

/* Remove Button */
.ptt-cart-item-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #bdc3c7;
  opacity: 0;
  transition: var(--ptt-transition);
}

.ptt-cart-item:hover .ptt-cart-item-remove {
  opacity: 1;
}

.ptt-cart-item-remove:hover {
  background: #fee;
  color: var(--ptt-primary);
}

/* -----------------------------------------------------------------------------
   Cart Footer (Totals & Actions)
   ----------------------------------------------------------------------------- */
.ptt-cart-footer {
  background: linear-gradient(to bottom, #fafafa, #f5f5f5);
  border-top: 1px solid var(--ptt-border);
  padding: 12px 16px 16px;
}

/* Totals */
.ptt-cart-totals {
  margin-bottom: 12px;
}

.ptt-cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
  color: var(--ptt-text-light);
}

.ptt-cart-total-row.ptt-cart-grand-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--ptt-border);
  font-size: 15px;
  font-weight: 700;
  color: var(--ptt-text);
}

.ptt-cart-total-row.ptt-cart-grand-total .ptt-cart-total-value {
  color: var(--ptt-primary);
  font-size: 18px;
}

/* Action Buttons */
.ptt-cart-actions {
  display: flex;
  gap: 8px;
}

.ptt-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--ptt-radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--ptt-transition);
  white-space: nowrap;
}

.ptt-btn svg {
  flex-shrink: 0;
}

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

.ptt-btn-primary:hover {
  background: var(--ptt-primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--ptt-shadow-sm);
}

.ptt-btn-secondary {
  background: var(--ptt-bg);
  color: var(--ptt-text);
  border: 1px solid var(--ptt-border);
}

.ptt-btn-secondary:hover {
  background: var(--ptt-bg-hover);
  border-color: #ddd;
  color: var(--ptt-text);
}

.ptt-btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

/* -----------------------------------------------------------------------------
   Empty Cart State
   ----------------------------------------------------------------------------- */
.ptt-cart-empty {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.ptt-cart-empty-icon {
  color: #ddd;
}

.ptt-cart-empty-text {
  font-size: 14px;
  color: var(--ptt-text-light);
  margin: 0;
}

/* -----------------------------------------------------------------------------
   Modern Notification System
   ----------------------------------------------------------------------------- */
.ptt-notify-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: var(--ptt-transition);
}

.ptt-notify-overlay.ptt-active {
  opacity: 1;
  visibility: visible;
}

.ptt-notify {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: var(--ptt-bg);
  border-radius: var(--ptt-radius);
  box-shadow: var(--ptt-shadow);
  z-index: 99999;
  overflow: hidden;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ptt-notify.ptt-active {
  transform: translateX(0);
  opacity: 1;
}

/* Notification Header */
.ptt-notify-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--ptt-success) 0%, #2ecc71 100%);
  color: #fff;
}

.ptt-notify-header.ptt-error {
  background: linear-gradient(135deg, var(--ptt-primary) 0%, #e74c3c 100%);
}

.ptt-notify-header-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
}

.ptt-notify-header-text {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

.ptt-notify-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  transition: var(--ptt-transition);
}

.ptt-notify-close:hover {
  background: rgba(255,255,255,0.3);
}

/* Notification Body */
.ptt-notify-body {
  padding: 16px;
}

.ptt-notify-product {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ptt-notify-product-image {
  width: 70px;
  height: 70px;
  border-radius: var(--ptt-radius-sm);
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
}

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

.ptt-notify-product-details {
  flex: 1;
  min-width: 0;
}

.ptt-notify-product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ptt-text);
  margin: 0 0 6px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ptt-notify-product-message {
  font-size: 13px;
  color: var(--ptt-text-light);
  margin: 0;
  line-height: 1.4;
}

/* Notification Footer */
.ptt-notify-footer {
  display: flex;
  gap: 10px;
  padding: 0 16px 16px;
}

.ptt-notify-footer .ptt-btn {
  flex: 1;
}

/* Cart Badge Animation */
@keyframes ptt-badge-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.ptt-badge-animate {
  animation: ptt-badge-pop 0.3s ease;
}

/* Success Checkmark Animation */
@keyframes ptt-checkmark {
  0% { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}

.ptt-notify-header-icon svg.ptt-animated {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: ptt-checkmark 0.5s ease forwards 0.2s;
}

/* -----------------------------------------------------------------------------
   Cart Header Button Enhancement - HIGH Z-INDEX TO STAY ON TOP
   ----------------------------------------------------------------------------- */
#cart_menu {
  z-index: 9999 !important;
}

#cart_menu:hover {
  z-index: 10000 !important;
}

/* Reset the grand total z-index so it doesn't overlap dropdown */
#cart_menu:hover .s_grand_total {
  z-index: auto !important;
  position: relative !important;
}

#cart_menu:hover > a {
  z-index: 1 !important;
}

#cart_menu .s_submenu {
  z-index: 10001 !important;
  border-radius: var(--ptt-radius) !important;
  overflow: visible !important;
}

#cart_menu .s_cart_holder {
  z-index: 10002 !important;
  position: relative !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: var(--ptt-shadow) !important;
  border-radius: var(--ptt-radius) !important;
  overflow: hidden !important;
}

#cart_menu .ptt-cart-modern {
  z-index: 10003 !important;
  position: relative !important;
}

/* Cart Badge */
.ptt-cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--ptt-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* -----------------------------------------------------------------------------
   Mobile Responsive
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .ptt-notify {
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0 0 var(--ptt-radius) var(--ptt-radius);
  }

  .ptt-cart-modern {
    width: 100%;
  }

  .ptt-notify-footer {
    flex-direction: column;
  }
}

/* -----------------------------------------------------------------------------
   Loading State
   ----------------------------------------------------------------------------- */
.ptt-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.ptt-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid var(--ptt-border);
  border-top-color: var(--ptt-primary);
  border-radius: 50%;
  animation: ptt-spin 0.8s linear infinite;
}

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

/* -----------------------------------------------------------------------------
   Shoppica2 Override Compatibility
   ----------------------------------------------------------------------------- */
#cart_menu .ptt-cart-modern {
  background: var(--ptt-bg);
}

#cart_menu .ptt-cart-item-name,
#cart_menu .ptt-cart-item-price,
#cart_menu .ptt-btn {
  font-family: inherit;
}

/* Ensure proper z-index stacking */
.ptt-notify-overlay,
.ptt-notify {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
