:root {
  --attr-primary: #0ea5e9;
  --attr-primary-hover: #e0f2fe;
  --attr-border: #e2e8f0;
  --attr-text: #334155;
  --attr-text-light: #64748b;
  --attr-bg: #ffffff;
  --attr-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  --attr-shadow-hover: 0 4px 6px -1px rgba(14, 165, 233, 0.2), 0 2px 4px -1px rgba(14, 165, 233, 0.1);
  --attr-radius: 8px;
}

.attribute-custom-frontend {
  padding: 24px 0;
  font-family: inherit;
  margin-bottom: 20px;
}

.attribute-custom-frontend .attribute {
  display: flex !important;
  align-items: flex-start;
  flex-direction: column;
  margin-bottom: 20px;
}

.attribute-custom-frontend .attribute > div:first-child:not(.items) {
  font-weight: 700;
  color: #000;
  margin-bottom: 10px;
  font-size: 15px;
}

.attribute-custom-frontend .attribute .selected-label {
  font-weight: 400;
  color: #64748b;
}

.attribute-custom-frontend .attribute .items {
  display: flex;
  align-items: center;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px; /* Uniform spacing */
}

/* Loading Animation */
.loading {
  position: relative;
}
.loading::after,
.loading::before {
  content: "";
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--attr-primary);
  position: absolute;
  left: calc(50% - 20px);
  top: 0;
  animation: animloader 2s linear infinite;
}
.loading::after {
  animation-delay: 1s;
}

@keyframes animloader {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* Hide native radio */
.attribute-custom-frontend .attribute input[type="radio"] {
  display: none;
}

/* Default Label Styles (Text based like Gender, Size, Area) */
.attribute-custom-frontend .attribute label {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 8px 16px;
  background: var(--attr-bg);
  border: 2px solid var(--attr-border);
  border-radius: var(--attr-radius);
  color: var(--attr-text);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  min-width: 48px;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--attr-shadow);
  user-select: none;
  white-space: nowrap;
}

/* Hover effect */
.attribute-custom-frontend .attribute label:hover {
  border-color: var(--attr-primary);
  background: var(--attr-primary-hover);
  color: var(--attr-primary);
  transform: translateY(-1px);
}

/* Checked effect (Text based) */
.attribute-custom-frontend .attribute input[type="radio"]:checked + label {
  background: var(--attr-primary);
  border-color: var(--attr-primary);
  color: #fff;
  box-shadow: var(--attr-shadow-hover);
}

/* Checkmark for text labels */
.attribute-custom-frontend .attribute input[type="radio"]:checked + label::after {
  content: "";
  display: block;
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background-color: #10b981; /* Green check circle */
  border-radius: 50%;
  border: 2px solid #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* STYLES (Image based) */
.attribute-custom-frontend .attribute.styles label.has-image {
  width: 70px;
  height: 70px;
  background-image: var(--image);
  background-size: cover;
  background-position: center;
  text-align: center;
  padding: 0;
  border-radius: 12px;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
}

/* Hover for styles */
.attribute-custom-frontend .attribute.styles label.has-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  border-color: var(--attr-primary-hover);
}

/* Checked for styles */
.attribute-custom-frontend .attribute.styles input[type="radio"]:checked + label.has-image {
  border-color: var(--attr-primary);
  box-shadow: 0 0 0 4px var(--attr-primary-hover), var(--attr-shadow-hover);
}

/* Checkmark for styles */
.attribute-custom-frontend .attribute.styles input[type="radio"]:checked + label.has-image::after {
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background-size: 14px;
}

/* COLORS (Circle based) */
.attribute-custom-frontend .attribute.colors label {
  background-color: var(--my-color) !important;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  min-width: unset;
  border: 2px solid var(--attr-border);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  text-indent: -9999px; /* Hide label text */
  overflow: hidden;
}

/* Hover for colors */
.attribute-custom-frontend .attribute.colors label:hover {
  transform: scale(1.1);
  border-color: var(--attr-primary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Checked for colors */
.attribute-custom-frontend .attribute.colors input[type="radio"]:checked + label {
  border-color: var(--attr-primary);
  box-shadow: 0 0 0 4px var(--attr-bg), 0 0 0 6px var(--attr-primary);
  background-color: var(--my-color) !important;
}

/* Remove default checkmark for colors and add a subtle inner check */
.attribute-custom-frontend .attribute.colors input[type="radio"]:checked + label::after {
  display: none; /* Hide the green checkmark */
}
.attribute-custom-frontend .attribute.colors input[type="radio"]:checked + label::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}
/* If the color is white, make the inner check dark */
.attribute-custom-frontend .attribute.colors input[type="radio"]:checked + label[id*="white" i]::before,
.attribute-custom-frontend .attribute.colors input[type="radio"]:checked + label[id*="\#fff" i]::before,
.attribute-custom-frontend .attribute.colors input[type="radio"]:checked + label[id*="trang" i]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E");
  filter: none;
}

/* Price display */
.custom-price-wrapper {
  display: block;
  margin-top: 15px;
  margin-bottom: 20px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--attr-primary);
  transition: color 0.3s ease;
}

/* Form structure */
.form-order {
  display: flex;
  flex-direction: column;
}
.attribute-custom-frontend p,
.attribute-custom-frontend > label,
.attribute-custom-frontend > span {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
  color: var(--attr-text);
}

/* Size Chart Button */
.custom-size-chart-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background-color: transparent;
  border: 1px solid var(--attr-border-selected, #2271b1);
  color: var(--attr-border-selected, #2271b1);
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
}
.custom-size-chart-btn:hover {
  background-color: var(--attr-border-selected, #2271b1);
  color: #fff;
}

/* Modal and Accordion Styles */
.custom-modal-overlay {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.65);
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.custom-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 40px;
  border-radius: 8px;
  width: 95%;
  max-width: 900px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.custom-modal-close {
  color: #999;
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 28px;
  line-height: 1;
  font-weight: normal;
  cursor: pointer;
  transition: color 0.2s;
}
.custom-modal-close:hover {
  color: #111;
}
.custom-modal-content h2 {
  margin-top: 0;
  margin-bottom: 30px;
  font-size: 26px;
  font-weight: 600;
  color: #222;
}

/* Accordion */
.custom-accordion {
  border-top: 1px solid #eaeaea;
}
.custom-accordion-header {
  background-color: transparent;
  color: #333;
  cursor: pointer;
  padding: 22px 10px;
  width: 100%;
  border: none;
  border-bottom: 1px solid #eaeaea;
  text-align: left;
  outline: none;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background-color 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.custom-accordion-header.active, .custom-accordion-header:hover {
  background-color: #fafafa;
  color: var(--attr-border-selected, #2271b1);
}
.custom-accordion-header::after {
  content: '\002B';
  color: #999;
  font-weight: normal;
  font-size: 24px;
}
.custom-accordion-header.active::after {
  content: "\2212";
  color: var(--attr-border-selected, #2271b1);
}
.custom-accordion-panel {
  padding: 0 10px;
  background-color: #fff;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
  border-bottom: 1px solid transparent;
}
.custom-accordion-header.active + .custom-accordion-panel {
  border-bottom: 1px solid #eaeaea;
}
.custom-accordion-inner {
  padding: 25px 0;
  overflow-x: auto;
}
.custom-accordion-inner img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Size Chart Table Styling */
.size-chart-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 14px;
  text-align: center;
  color: #555;
  font-family: inherit;
}
.size-chart-table th, .size-chart-table td {
  padding: 16px 12px;
  border-bottom: 1px solid #eaeaea;
}
.size-chart-table th {
  background-color: #fff;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #eaeaea;
}
.size-chart-table tbody tr:hover {
  background-color: #fcfcfc;
}
.size-chart-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: #444;
}
