/**
 * Shiko Enhanced Checkout & Cart - Global Styles
 * Shared animations, utilities, and responsive framework
 * Version: 2.0.1
 */

/* ===== ROOT VARIABLES ===== */

:root {
  --shiko-primary: #c41e3a;
  --shiko-secondary: #a01630;
  --shiko-dark: #1a1a1a;
  --shiko-light: #f8f9fa;
  --shiko-border: #e0e0e0;
  --shiko-text: #333;
  --shiko-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shiko-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shiko-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shiko-radius: 6px;
  --shiko-transition: all 0.3s ease;
}

/* ===== GLOBAL ANIMATIONS ===== */

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* ===== UTILITY CLASSES ===== */

.hidden {
  display: none !important;
  visibility: hidden;
}

.visible {
  display: block !important;
  visibility: visible;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-small {
  gap: 8px;
}

.gap-medium {
  gap: 15px;
}

.gap-large {
  gap: 25px;
}

.mt-small {
  margin-top: 8px;
}

.mt-medium {
  margin-top: 15px;
}

.mt-large {
  margin-top: 25px;
}

.mb-small {
  margin-bottom: 8px;
}

.mb-medium {
  margin-bottom: 15px;
}

.mb-large {
  margin-bottom: 25px;
}

.p-small {
  padding: 8px;
}

.p-medium {
  padding: 15px;
}

.p-large {
  padding: 25px;
}

.rounded {
  border-radius: var(--shiko-radius);
}

.rounded-lg {
  border-radius: 8px;
}

.shadow-sm {
  box-shadow: var(--shiko-shadow-sm);
}

.shadow-md {
  box-shadow: var(--shiko-shadow-md);
}

.shadow-lg {
  box-shadow: var(--shiko-shadow-lg);
}

.border {
  border: 1px solid var(--shiko-border);
}

.border-top {
  border-top: 1px solid var(--shiko-border);
}

.border-bottom {
  border-bottom: 1px solid var(--shiko-border);
}

.color-primary {
  color: var(--shiko-primary);
}

.color-dark {
  color: var(--shiko-dark);
}

.bg-light {
  background-color: var(--shiko-light);
}

.bg-white {
  background-color: white;
}

.font-bold {
  font-weight: 700;
}

.font-semi-bold {
  font-weight: 600;
}

.font-normal {
  font-weight: 400;
}

.transition {
  transition: var(--shiko-transition);
}

.cursor-pointer {
  cursor: pointer;
}

/* ===== FORM UTILITIES ===== */

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid var(--shiko-primary);
  outline-offset: 2px;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== BUTTON STYLES =====*/

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: var(--shiko-radius);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--shiko-transition);
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background-color: var(--shiko-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--shiko-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shiko-shadow-lg);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shiko-shadow-md);
}

.btn-secondary {
  background-color: white;
  color: var(--shiko-primary);
  border: 2px solid var(--shiko-primary);
}

.btn-secondary:hover {
  background-color: var(--shiko-light);
  border-color: var(--shiko-secondary);
  color: var(--shiko-secondary);
}

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

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
  display: block;
}

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

/* ===== LOADING STATES ===== */

.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(196, 30, 58, 0.3);
  border-top-color: var(--shiko-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== MESSAGES ===== */

.notice {
  padding: 15px 20px;
  margin-bottom: 20px;
  border-left: 4px solid var(--shiko-border);
  border-radius: var(--shiko-radius);
  background: white;
}

.notice-success {
  border-left-color: #00a32a;
  background: #ecf7f0;
  color: #1a3a1a;
}

.notice-error {
  border-left-color: var(--shiko-primary);
  background: #fef5f5;
  color: #3a1a1a;
}

.notice-warning {
  border-left-color: #dba617;
  background: #fef9f0;
  color: #3a2a1a;
}

.notice-info {
  border-left-color: #0073aa;
  background: #f0f5ff;
  color: #1a2a3a;
}

/* ===== BADGES ===== */

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--shiko-primary);
  color: white;
}

.badge-secondary {
  background: var(--shiko-light);
  color: var(--shiko-dark);
}

.badge-success {
  background: #00a32a;
  color: white;
}

/* ===== RESPONSIVE TEXT =====*/

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }

  .show-desktop {
    display: block !important;
  }
}

/* ===== PRINT STYLES ===== */

@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white;
  }

  .btn,
  button {
    display: none;
  }
}

/* ===== ACCESSIBILITY ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== DARK MODE SUPPORT (Future) ===== */

@media (prefers-color-scheme: dark) {
  :root {
    --shiko-light: #2a2a2a;
    --shiko-border: #444;
    --shiko-text: #e0e0e0;
  }
}

/* =====================================================
   MINI-CART SIDE PANEL — Proposal A (compact rows)
   Targets Ecomus theme .cart-panel structure.
   ===================================================== */

/* --- Panel container --- */
.cart-panel .panel__container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* --- Header --- */
.cart-panel .panel__header {
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

/* --- Scrollable content area --- */
.cart-panel .panel__content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cart-panel .widget_shopping_cart_content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* --- Product list --- */
.cart-panel .elementor-menu-cart__products.woocommerce-mini-cart {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 0;
}

/* --- Cart item: compact row layout --- */
.cart-panel .elementor-menu-cart__product {
  display: grid !important;
  grid-template-columns: 68px 1fr auto;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "img name   price"
    "img qty    price"
    "img remove .";
  gap: 2px 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
  align-items: center;
}

.cart-panel .elementor-menu-cart__product:last-of-type {
  border-bottom: none;
}

/* --- Product thumbnail: compact 68px square --- */
.cart-panel .elementor-menu-cart__product-image.product-thumbnail {
  grid-area: img;
  width: 68px !important;
  height: 68px !important;
  overflow: hidden;
  border-radius: 10px;
  background: #f8f8f8;
  flex-shrink: 0;
  align-self: start;
}

.cart-panel .elementor-menu-cart__product-image.product-thumbnail a {
  display: block;
  width: 68px;
  height: 68px;
}

.cart-panel .elementor-menu-cart__product-image.product-thumbnail img {
  width: 68px !important;
  height: 68px !important;
  object-fit: cover;
  border-radius: 10px;
}

/* --- Product name: single line with ellipsis --- */
.cart-panel .elementor-menu-cart__product-name.product-name {
  grid-area: name;
  min-width: 0;
  align-self: end;
}

.cart-panel .elementor-menu-cart__product-name.product-name a {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cart-panel .elementor-menu-cart__product-name.product-name a:hover {
  color: var(--shiko-primary);
}

/* --- Price + qty controls row --- */
.cart-panel .elementor-menu-cart__product-price.product-price {
  grid-area: qty;
  display: flex !important;
  align-items: center;
  gap: 0;
  align-self: center;
}

.cart-panel .elementor-menu-cart__product-price .quantity {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ebebeb;
  border-radius: 8px;
  height: 30px;
  overflow: hidden;
}

.cart-panel .elementor-menu-cart__product-price .ecomus-qty-button {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #888;
  transition: background 0.15s;
}

.cart-panel .elementor-menu-cart__product-price .ecomus-qty-button:hover {
  background: #f5f5f5;
  color: #333;
}

.cart-panel .elementor-menu-cart__product-price .quantity input.qty {
  width: 28px !important;
  height: 30px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  border: none;
  border-left: 1px solid #ebebeb;
  border-right: 1px solid #ebebeb;
  padding: 0;
  -moz-appearance: textfield;
  background: transparent;
}

.cart-panel .elementor-menu-cart__product-price .quantity input.qty::-webkit-inner-spin-button,
.cart-panel .elementor-menu-cart__product-price .quantity input.qty::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Amount display next to qty (if present outside .quantity) */
.cart-panel .elementor-menu-cart__product-price > .woocommerce-Price-amount,
.cart-panel .elementor-menu-cart__product-price > .amount {
  display: none;
}

/* --- Item price column (right side) --- */
.cart-panel .elementor-menu-cart__product > .woocommerce-Price-amount,
.cart-panel .elementor-menu-cart__product > .amount {
  grid-area: price;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: right;
  align-self: center;
}

/* --- Remove link: compact text --- */
.cart-panel .elementor-menu-cart__product-remove.product-remove {
  grid-area: remove;
  align-self: start;
}

.cart-panel .elementor-menu-cart__product-remove .shiko-remove-link {
  font-size: 11px;
  color: var(--shiko-primary);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.cart-panel .elementor-menu-cart__product-remove .shiko-remove-link:hover {
  opacity: 0.7;
}

/* Fix: hide the duplicate remove link */
.cart-panel .elementor-menu-cart__product-remove .shiko-remove-link + .shiko-remove-link {
  display: none !important;
}

/* Also hide the original WooCommerce × remove if it co-exists */
.cart-panel .elementor-menu-cart__product-remove > a.remove:not(.shiko-remove-link) {
  display: none !important;
}

/* --- Progress / spend bar (injected by JS) --- */
.shiko-minicart-progress {
  padding: 12px 20px 14px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.shiko-minicart-progress__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.3;
}

.shiko-minicart-progress__text {
  color: #666;
}

.shiko-minicart-progress__text strong {
  color: var(--shiko-primary);
  font-weight: 700;
}

.shiko-minicart-progress__pct {
  font-weight: 700;
  font-size: 11px;
  color: #999;
}

.shiko-minicart-progress__track {
  width: 100%;
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.shiko-minicart-progress__fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--shiko-primary) 0%, #e85d75 100%);
  transition: width 0.5s ease;
  min-width: 4px;
}

/* Reached goal state */
.shiko-minicart-progress--complete .shiko-minicart-progress__fill {
  background: linear-gradient(90deg, #1d9e75 0%, #5dcaa5 100%);
}

.shiko-minicart-progress--complete .shiko-minicart-progress__text {
  color: #1d9e75;
}

.shiko-minicart-progress--complete .shiko-minicart-progress__text strong {
  color: #1d9e75;
}

.shiko-minicart-progress--complete .shiko-minicart-progress__pct {
  color: #1d9e75;
}

/* --- "Customers also bought" recommendations --- */
.cart-panel .ecomus-mini-products-recommended {
  padding: 12px 20px;
  border-top: 6px solid #f9f9f9;
}

.cart-panel .ecomus-mini-products-recommended .products-recommended-header {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}

/* --- Subtotal row --- */
.cart-panel .elementor-menu-cart__subtotal {
  padding: 14px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cart-panel .elementor-menu-cart__subtotal strong {
  font-size: 13px;
  font-weight: 500;
  color: #888;
}

.cart-panel .elementor-menu-cart__subtotal .woocommerce-Price-amount {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}

.cart-panel .elementor-menu-cart__subtotal .ecomus-price-saved {
  font-size: 11px;
  font-weight: 600;
  color: #1d9e75;
  background: #e8f5ee;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 6px;
}

/* --- Footer buttons --- */
.cart-panel .elementor-menu-cart__footer-buttons {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.cart-panel .elementor-menu-cart__footer-buttons .elementor-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.cart-panel .elementor-menu-cart__footer-buttons .elementor-button--view-cart {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
}

.cart-panel .elementor-menu-cart__footer-buttons .elementor-button--view-cart:hover {
  background: #f8f8f8;
  border-color: #ccc;
}

.cart-panel .elementor-menu-cart__footer-buttons .elementor-button--checkout {
  background: var(--shiko-primary);
  color: #fff;
  border: 1px solid var(--shiko-primary);
  flex: 1.4;
}

.cart-panel .elementor-menu-cart__footer-buttons .elementor-button--checkout:hover {
  background: var(--shiko-secondary);
  border-color: var(--shiko-secondary);
}

/* --- Hidden field utility --- */
.shiko-hidden-field {
  display: none !important;
}
