/**
 * WooCommerce Horizontal Dashboard Menu Styles v2.0.0
 * Clean, minimal design with enhanced mobile experience
 */

/* Reset and base styles */
.whdm-navigation {
  width: 100%;
  background-color: transparent;
  margin-bottom: 1rem;
  margin-left: 0;
  padding: 0;
  border: none;
  position: relative;
  z-index: 10;
  box-shadow: none !important;
  transition: all 0.3s ease;
}

.whdm-container {
  max-width: 100%;
  padding: 0;
  margin: 0;
  position: relative;
  background-color: transparent;
  border: none;
  box-shadow: none;
}

/* Menu base styles */
.whdm-menu {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
}

.whdm-menu li {
  margin: 0;
  padding: 0;
  position: relative;
}

.whdm-menu li:first-child {
  margin-left: 0;
  padding-left: 0;
}

.whdm-menu li:first-child a {
  margin-left: 0;
}

/* Menu link styles */
.whdm-menu li a,
.whdm-menu-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  color: #555555;
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 4px;
  margin: 5px;
  background-color: #ffffff;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
  border: none;
  white-space: nowrap;
}

.whdm-menu li a:hover {
  background-color: #f7f7f7;
  color: #000000;
  text-decoration: none;
}

.whdm-menu li.is-active a {
  background-color: #f7f7f7 !important;
  color: #000000 !important;
  font-weight: 500;
}

/* Icon styles */
.whdm-icon {
  margin-right: 0.5rem;
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  flex-shrink: 0;
}

.whdm-icon.dashicons {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  font-weight: 400;
}

.whdm-menu li.is-active .whdm-icon {
  opacity: 1;
}

.whdm-label {
  flex: 1;
  text-align: left;
}

/* Layout variations */
.whdm-layout-minimal .whdm-menu li.is-active a {
  background-color: #f7f7f7 !important;
  color: #000000 !important;
}

.whdm-layout-tabs .whdm-menu {
  border-bottom: none;
}

.whdm-layout-tabs .whdm-menu li a {
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
  border: 1px solid transparent;
}

.whdm-layout-tabs .whdm-menu li.is-active a {
  border: none !important;
  border-bottom-color: transparent;
  background-color: #f7f7f7 !important;
  color: #000000 !important;
}

.whdm-layout-buttons .whdm-menu li a {
  border: 1px solid #eee;
  background-color: #ffffff;
}

.whdm-layout-buttons .whdm-menu li.is-active a {
  border: 1px solid #ddd;
  background-color: #f7f7f7 !important;
  color: #000000 !important;
}

.whdm-layout-pills .whdm-menu li a {
  border-radius: 20px !important;
  padding: 0.4rem 0.8rem;
}

.whdm-layout-pills .whdm-menu li.is-active a {
  background-color: #f7f7f7 !important;
  color: #000000 !important;
}

/* Sticky header */
.whdm-sticky {
  position: sticky;
  top: 32px;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.admin-bar .whdm-sticky {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .whdm-sticky {
    top: 46px;
  }
}

/* Mobile slider styles */
.whdm-slider-container {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  overflow: hidden;
  background-color: transparent;
  border: none;
  box-shadow: none;
  padding: 0 50px;
}

.whdm-slider-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.whdm-slider-scroll {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding: 12px 8px;
  cursor: grab;
  background-color: transparent;
  border: none;
  box-shadow: none;
  touch-action: pan-x;
  width: 100%;
  will-change: scroll-position;
  transform: translateZ(0);
}

.whdm-slider-scroll.active {
  cursor: grabbing;
}

.whdm-slider-scroll::-webkit-scrollbar {
  display: none;
}

/* Navigation arrows */
.whdm-slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  padding: 0;
  color: #555555;
  opacity: 0.9;
}

.whdm-slider-nav:hover {
  background-color: #f7f7f7;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-50%) scale(1.05);
  opacity: 1;
}

.whdm-slider-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.whdm-slider-prev {
  left: 8px;
}

.whdm-slider-next {
  right: 8px;
}

.whdm-slider-nav .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.whdm-nav-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
}

.whdm-slider-nav.whdm-nav-active {
  transform: translateY(-50%) scale(0.95);
  background-color: #f0f0f0;
}

/* Dashboard styles */
.whdm-dashboard-greeting {
  font-size: 1.2em;
  margin-bottom: 1.5em;
}

.whdm-dashboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2em;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.whdm-dashboard-table th,
.whdm-dashboard-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.whdm-dashboard-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.whdm-dashboard-table tr:hover {
  background-color: #f9f9f9;
}

.whdm-dashboard-table tr:last-child td {
  border-bottom: none;
}

.whdm-dashboard-metric {
  font-weight: 600;
  color: #28a745;
}

/* Page title styles */
.woocommerce-page-title {
  margin-top: 0;
  margin-bottom: 1.5em;
  font-size: 1.8em;
  color: #333;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .whdm-navigation {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 0;
    background-color: transparent;
  }

  .whdm-container {
    width: 100%;
    padding: 0;
    margin: 0;
  }

  .whdm-slider-container {
    position: relative;
    width: 100%;
    margin: 0;
    overflow: hidden;
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0 45px;
  }

  .whdm-slider-scroll {
    padding: 8px 4px;
    cursor: grab;
    background-color: transparent;
    border: none;
    box-shadow: none;
    touch-action: pan-x;
    width: 100%;
    position: relative;
  }

  .whdm-menu {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    padding: 4px 0;
    min-width: 100%;
    gap: 4px;
  }

  .whdm-menu li {
    flex: 0 0 auto;
    white-space: nowrap;
    min-width: 90px;
  }

  .whdm-menu li a {
    margin: 2px 4px;
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    background-color: #ffffff;
    color: #555555;
    transition: all 0.2s ease;
  }

  .whdm-menu li:first-child a {
    margin-left: 4px;
  }

  .whdm-menu li:last-child a {
    margin-right: 4px;
  }

  .whdm-icon {
    margin-right: 4px;
    font-size: 14px;
    width: 14px;
    height: 14px;
  }

  .whdm-menu li.is-active a {
    background-color: #f7f7f7 !important;
    color: #000000 !important;
    font-weight: 600;
    transform: scale(1.02);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  }

  .whdm-menu li a:active {
    transform: scale(0.98);
    transition: transform 0.1s;
  }

  .whdm-slider-nav {
    width: 36px;
    height: 36px;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    color: #555555;
    opacity: 0.95;
  }

  .whdm-slider-nav:hover,
  .whdm-slider-nav:active {
    background-color: #f7f7f7;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.05);
    opacity: 1;
  }

  .whdm-slider-prev {
    left: 4px;
  }

  .whdm-slider-next {
    right: 4px;
  }

  .whdm-slider-nav .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
  }

  .whdm-dashboard-table {
    font-size: 0.9em;
  }

  .whdm-dashboard-table th,
  .whdm-dashboard-table td {
    padding: 8px 10px;
  }

  /* Ensure consistent active states across layouts */
  .whdm-layout-tabs .whdm-menu li.is-active a,
  .whdm-layout-minimal .whdm-menu li.is-active a,
  .whdm-layout-buttons .whdm-menu li.is-active a,
  .whdm-layout-pills .whdm-menu li.is-active a {
    background-color: #f7f7f7 !important;
    color: #000000 !important;
    border: none !important;
    font-weight: 600;
  }

  /* Improve touch target size */
  .whdm-menu li a::before {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    z-index: -1;
  }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
  .whdm-slider-container {
    padding: 0 40px;
  }

  .whdm-menu li {
    min-width: 80px;
  }

  .whdm-menu li a {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 36px;
  }

  .whdm-slider-nav {
    width: 32px;
    height: 32px;
  }

  .whdm-slider-nav .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
  }

  .whdm-icon {
    margin-right: 3px;
    font-size: 12px;
    width: 12px;
    height: 12px;
  }
}

/* Hide original WooCommerce navigation */
.woocommerce-MyAccount-navigation {
  display: none !important;
}

/* Adjust content area */
.woocommerce-account .woocommerce-MyAccount-content {
  width: 100% !important;
  float: none !important;
}

/* RTL Support */
.rtl .whdm-icon {
  margin-right: 0;
  margin-left: 0.5rem;
}

@media (max-width: 768px) {
  .rtl .whdm-icon {
    margin-right: 0;
    margin-left: 0.25rem;
  }
}

/* Custom endpoint styles */
.whdm-deliveries-endpoint .whdm-menu li a[href*="my-deliveries"] {
  background-color: #f7f7f7 !important;
  color: #000000 !important;
  font-weight: 500;
}

/* Loading state */
.whdm-loading {
  opacity: 0.6;
  pointer-events: none;
}

.whdm-loading .whdm-slider-nav {
  opacity: 0.3;
}

/* Smooth scrolling behavior */
.whdm-slider-scroll {
  scroll-snap-type: x proximity;
}

.whdm-menu li {
  scroll-snap-align: start;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .whdm-menu li a {
    border: 2px solid #000;
  }

  .whdm-menu li.is-active a {
    background-color: #000 !important;
    color: #fff !important;
  }

  .whdm-slider-nav {
    border: 2px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .whdm-menu li a,
  .whdm-slider-nav,
  .whdm-slider-scroll {
    transition: none;
  }

  .whdm-slider-scroll {
    scroll-behavior: auto;
  }
}

/* Focus styles for accessibility */
.whdm-menu li a:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

.whdm-slider-nav:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .whdm-slider-nav {
    display: none;
  }

  .whdm-navigation {
    position: static;
  }
}

/* Animation for menu items */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.whdm-menu li {
  animation: fadeInUp 0.3s ease-out;
}

.whdm-menu li:nth-child(1) {
  animation-delay: 0.1s;
}
.whdm-menu li:nth-child(2) {
  animation-delay: 0.2s;
}
.whdm-menu li:nth-child(3) {
  animation-delay: 0.3s;
}
.whdm-menu li:nth-child(4) {
  animation-delay: 0.4s;
}
.whdm-menu li:nth-child(5) {
  animation-delay: 0.5s;
}
.whdm-menu li:nth-child(6) {
  animation-delay: 0.6s;
}

/* Disable animations for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .whdm-menu li {
    animation: none;
  }
}

/* Wishlist page specific styles */
.whdm-wishlist-nav {
  margin-bottom: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
}

.whdm-wishlist-page .whdm-navigation {
  position: relative;
  z-index: 100;
}

/* Ensure menu appears above wishlist content */
.whdm-wishlist-page .whdm-wishlist-nav {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Mobile adjustments for wishlist page */
@media (max-width: 768px) {
  .whdm-wishlist-page .whdm-slider-container {
    margin: 0 -20px;
    padding: 0 60px;
  }

  .whdm-wishlist-nav {
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
  }
}

/* Integration with common wishlist plugin styles */
.whdm-wishlist-page .yith-wcwl-wishlist-title,
.whdm-wishlist-page .tinvwl-header,
.whdm-wishlist-page .wc-wishlist-header {
  margin-top: 1rem;
}

/* Sticky behavior on wishlist pages */
.whdm-wishlist-page .whdm-sticky {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Smooth integration with page content */
.whdm-wishlist-nav + .woocommerce,
.whdm-wishlist-nav + .entry-content,
.whdm-wishlist-nav + .page-content {
  margin-top: 0;
}

/* Hide original page title if it conflicts */
.whdm-wishlist-page .entry-title:first-of-type {
  margin-top: 1rem;
}
