.locations-page {
  padding-top: 140px;
  min-height: 100vh;
  background-color: var(--color-studio-bg);
  padding-bottom: 30px;
}

@media (max-width: 1024px) {
  .locations-page {
    padding-top: 85px;
  }
}

.locations-hero {
  max-width: 1400px;
  margin: 0 auto;
  padding: 4rem 5vw 2rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 1100px) {
  .locations-hero {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 4rem;
  }
}

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

@media (min-width: 1100px) {
  .locations-hero__copy {
    flex: 0.8;
    text-align: left;
  }
}

.locations-hero__copy h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  color: var(--color-tertiary);
  margin-bottom: 1rem;
}

.locations-hero__copy p {
  color: #4a4a4a;
  max-width: 800px;
  line-height: 1.6;
  margin: 0 auto;
}

@media (min-width: 1100px) {
  .locations-hero__copy p {
    margin: 0;
  }
}

.eyebrow {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-secondary);
  margin-bottom: 0.5rem;
}

/* Cards 2D Fan Layout */

.cards-3d-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin-top: 2rem;
  padding: 4rem 0;
  perspective: 1200px;
  zoom: 0.85; /* Reduced base size for 1920x1080 screens */
}

@media (min-width: 1100px) {
  .cards-3d-container {
    flex: 1.2;
    margin-top: 0;
  }
}

.card-3d {
  position: relative;
  width: 280px;
  height: 360px;
  border-radius: 1.25rem;
  transition: transform 0.3s ease;
}

.card-bg {
  position: absolute;
  inset: 0;
  border-radius: 1.25rem;
  box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.card-content {
  position: absolute;
  inset: 0;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
}

.card-text-container {
  margin-top: auto;
  max-width: 95%;
}

.card-left {
  transform: rotateY(25deg) rotateZ(-12deg) translateX(10px) translateY(20px);
  z-index: 1;
  width: 280px;
}


.card-center {
  transform: translateZ(50px);
  z-index: 2;
}


.card-right {
  transform: rotateY(-25deg) rotateZ(12deg) translateX(-10px) translateY(20px);
  z-index: 1;
  width: 280px;
  height: 360px;
}


/* Responsive Cards - Shrink instead of stack */
@media (max-width: 1440px) {
  .cards-3d-container { zoom: 0.75; }
}
@media (max-width: 1200px) {
  .cards-3d-container { zoom: 0.65; }
}
@media (max-width: 900px) {
  .cards-3d-container { zoom: 0.55; }
}
@media (max-width: 700px) {
  .cards-3d-container { zoom: 0.45; }
}
@media (max-width: 500px) {
  .cards-3d-container { zoom: 0.38; }
}
@media (max-width: 400px) {
  .cards-3d-container { zoom: 0.32; }
}


.locations-shell {
  width: 92%;
  max-width: 1400px;
  margin: 0 auto 2rem auto;
  padding: 0 0 2rem 0; /* Changed padding to allow header edge-to-edge */
  background: white;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 31, 85, 0.08);
}

.table-toolbar {
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 1px solid #eaeaea;
  background-color: #fafafa;
  position: relative;
  z-index: 30;
}

.table-toolbar h2 {
  font-size: 1.5rem;
  color: var(--color-tertiary);
  font-weight: 800;
}

.search-wrapper {
  width: 100%;
  max-width: 600px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.search-control {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

@keyframes pulseOrange {
  0%, 100% { opacity: 0.4; color: #FF421D; }
  50% { opacity: 1; color: #FF421D; }
}

.search-control .search-icon {
  position: absolute;
  left: 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  animation: pulseOrange 2s infinite ease-in-out;
}


/* Hide native search input cross buttons to prevent double icons */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

.search-control input {
  width: 100%;
  padding: 0.75rem 2.75rem 0.75rem 3.5rem;
  border: 1px solid #eaeaea;
  border-radius: 2rem;
  outline: none;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

@media (max-width: 768px) {
  .search-control input {
    font-size: 0.75rem;
  }
}

.search-control input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 31, 85, 0.1);
}

.result-meta {
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  background: #ffffff;
  font-size: 0.875rem;
  color: #666;
  border-bottom: 1px solid #eaeaea;
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  z-index: 10;
}
.clear-btn:hover {
  color: var(--color-secondary);
}

.locations-table-wrap {
  width: 100%;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  margin-top: 1rem;
}

@media (max-width: 1024px) {
  .locations-table-wrap {
    overflow-x: auto;
  }
  .locations-table {
    min-width: 950px;
    width: 100%;
  }
  .locations-table thead {
    position: relative;
    top: 0 !important;
  }
  .locations-table th::before {
    display: none;
  }
  .mobile-sticky-header {
    background: #001F55 !important;
    border-radius: 0.5rem 0.5rem 0 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .mobile-sticky-header table {
    border-collapse: separate;
    border-spacing: 0;
  }
  .mobile-sticky-header th {
    background: #001F55;
    color: #fff;
    text-align: left;
    padding: 0.75rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-right: 1px solid rgba(255,255,255,0.15);
    box-sizing: border-box;
  }
  .mobile-sticky-header th:last-child {
    border-right: none;
  }
}

.locations-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.locations-table th, 
.locations-table td {
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.locations-table th:last-child,
.locations-table td:last-child {
  border-right: none;
}

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

.locations-table th:first-child {
  border-top-left-radius: 0.5rem;
}

.locations-table th:last-child {
  border-top-right-radius: 0.5rem;
}

.locations-table thead {
  position: sticky;
  top: 100px;
  z-index: 25;
}

.locations-table th {
  position: relative;
  background: #001F55;
  color: white;
  text-align: left;
  padding: 1.25rem 1rem;
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-right-color: rgba(255, 255, 255, 0.3);
  border-bottom-color: #e2e8f0;
}

.locations-table td.phone-cell { white-space: normal; line-height: 1.6; }

/* Domestic 6-column widths (Province, District, Branch Name, Phone, Email, Full Address) */
.locations-table[data-mode="domestic"] { table-layout: fixed; width: 100%; }
.locations-table[data-mode="domestic"] th:nth-child(1) { width: 120px; }
.locations-table[data-mode="domestic"] th:nth-child(2) { width: 120px; }
.locations-table[data-mode="domestic"] th:nth-child(3) { width: 200px; }
.locations-table[data-mode="domestic"] th:nth-child(4) { width: 140px; }
.locations-table[data-mode="domestic"] th:nth-child(5) { width: 190px; }
.locations-table[data-mode="domestic"] th:nth-child(6) { width: 240px; }
.locations-table[data-mode="domestic"] td:nth-child(6) { overflow: hidden; text-overflow: ellipsis; word-break: break-word; }
.locations-table[data-mode="domestic"] td { overflow: hidden; text-overflow: ellipsis; }

/* International 8-column widths (Country, Branch Code, Branch Name, District, Phone, Email, Maps, Address) */
.locations-table[data-mode="international"] { table-layout: fixed; width: 100%; }
.locations-table[data-mode="international"] th:nth-child(1) { width: 150px; }
.locations-table[data-mode="international"] th:nth-child(2) { width: 100px; text-align: center; padding-left: 0.2rem; padding-right: 0.2rem; }
.locations-table[data-mode="international"] td:nth-child(2) { text-align: center; padding-left: 0.2rem; padding-right: 0.2rem; }
.locations-table[data-mode="international"] th:nth-child(3) { width: 200px; }
.locations-table[data-mode="international"] th:nth-child(4) { width: 130px; }
.locations-table[data-mode="international"] th:nth-child(5) { width: 140px; }
.locations-table[data-mode="international"] th:nth-child(6) { width: 180px; }
.locations-table[data-mode="international"] th:nth-child(7) { width: 70px; }
.locations-table[data-mode="international"] th:nth-child(8) { width: 230px; }
.locations-table[data-mode="international"] td:nth-child(8) { overflow: hidden; text-overflow: ellipsis; word-break: break-word; }
.locations-table[data-mode="international"] td { overflow: hidden; text-overflow: ellipsis; }

/* Country first-row toggle */
.country-country-first {
  cursor: pointer;
  user-select: none;
}
.country-country-first:hover td {
  background: #f8fbff;
}
.country-country-first td:first-child {
  border-left: 3px solid transparent;
}
.country-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: #0f172a;
}
.country-country-first:not(.expanded) .country-toggle {
  transform: rotate(-90deg);
}

/* International table row spanning look for active group */
.locations-table[data-mode="international"] .country-country-first.expanded td {
  border-bottom-color: transparent;
}
.locations-table[data-mode="international"] .country-branch:not(.country-country-first) td {
  border-bottom-color: transparent;
}
.locations-table[data-mode="international"] .country-branch.group-last-row td {
  border-bottom-color: #e2e8f0;
}

/* Province toggle rows (first branch of first district acts as province toggle) */
.prov-toggle {
  cursor: pointer;
  user-select: none;
}
.locations-table .prov-toggle:hover td {
  background: #f0f4f8;
}
.prov-toggle td:first-child {
  border-left: 3px solid transparent;
}
.prov-toggle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: #0f172a;
}
.prov-toggle:not(.expanded) .prov-toggle-arrow {
  transform: rotate(-90deg);
}

/* Inline district toggle in province row */
.prov-toggle .dist-inline-name {
  cursor: pointer;
}
.dist-cell-toggle {
  cursor: pointer;
}
.dist-cell-toggle:hover {
  background: #f4f6f9;
}
.prov-toggle .dist-toggle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: #475569;
  cursor: pointer;
}
.prov-toggle:not(.first-dist-expanded) .dist-toggle-arrow {
  transform: rotate(-90deg);
}

/* District toggle rows */
.dist-toggle {
  cursor: pointer;
  user-select: none;
}
.locations-table .dist-toggle:hover td {
  background: #f4f6f9;
}
.dist-toggle td:nth-child(2) {
  border-left: 3px solid transparent;
}
.dist-toggle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: #475569;
}
.dist-toggle:not(.expanded) .dist-toggle-arrow {
  transform: rotate(-90deg);
}
.locations-table[data-mode="domestic"] .dist-toggle.expanded td {
  border-bottom-color: transparent;
}
.locations-table[data-mode="domestic"] .dist-row td:nth-child(2) {
  border-left: 3px solid transparent;
}

/* Domestic table row spanning look for active group */
.locations-table[data-mode="domestic"] .prov-toggle.first-dist-expanded td {
  border-bottom-color: transparent;
}
.locations-table[data-mode="domestic"] .branch-row:not(.prov-toggle):not(.dist-row) td {
  border-bottom-color: #e2e8f0;
}
.locations-table[data-mode="domestic"] .branch-row.group-last-row td {
  border-bottom-color: #cbd5e1;
}

/* Branch data rows under province */
.branch-row td:first-child {
  border-left: 3px solid transparent;
}

@keyframes premiumShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-shimmer {
  background-color: #f1f5f9;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: premiumShimmer 1.5s infinite ease-in-out;
  border-radius: 6px;
}

.active-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.active-badge.active-yes {
  background: #dcfce7;
  color: #166534;
}

.active-badge.active-no {
  background: #fee2e2;
  color: #991b1b;
}

.locations-table th::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: -2px;
  right: -2px;
  height: 200px;
  background-color: white;
  z-index: -1;
  pointer-events: none;
}

.locations-table td {
  padding: 1.25rem 1rem;
  font-size: 0.8125rem;
  color: #444;
  vertical-align: top;
  font-family: 'Inter', sans-serif;
  text-align: left;
  transition: background-color 0.2s;
}

.locations-table td.text-center {
  text-align: center;
}

.locations-table .branch-row:not(.prov-toggle):not(.single-branch):not(.dist-row) td,
.locations-table .country-branch:not(.country-country-first):not(.single-branch) td {
  padding: 0 !important;
}

.td-wrapper {
  overflow: hidden;
}

.td-content {
  padding: 1.25rem 1rem;
  box-sizing: border-box;
}

.cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
}
.branch-row.dist-toggle.expanded .cell-clamp,
.branch-row.prov-toggle.first-dist-expanded .cell-clamp {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.locations-table tr {
  transition: all 0.2s ease;
}

.locations-table tr:hover td {
  background: #f8fbff; /* subtle primary blue hover */
  color: var(--color-primary-dark);
}

.locations-table tr:hover td:first-child {
  border-left: 3px solid var(--color-secondary);
}

.areas-covered {
  font-size: 0.8rem;
  max-width: 320px;
  line-height: 1.5;
  color: #555;
}

.highlight {
  background-color: rgba(255, 66, 29, 0.2); /* secondary color highlight */
  color: var(--color-secondary-dark);
}

.location-icon {
  color: var(--color-primary);
  transition: transform 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #f0f4ff;
}

.location-icon:hover {
  transform: scale(1.15);
  color: var(--color-secondary);
  background-color: white;
  box-shadow: 0 4px 10px rgba(255, 66, 29, 0.15);
}

.empty-state {
  padding: 6rem 2rem;
  text-align: center;
  color: #666;
}

.empty-state h3 {
  font-size: 1.5rem;
  color: var(--color-tertiary);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

/* Scrollbar for table */
.locations-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.locations-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.locations-table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.locations-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}



/* Desktop Table Optimizations to prevent horizontal scrolling */
@media (max-width: 1440px) {
  .locations-table th, .locations-table td {
    padding: 1rem 0.5rem;
    font-size: 0.8rem;
  }
  .locations-table th {
    white-space: normal;
    line-height: 1.2;
    padding: 1rem 0.5rem;
  }
  .areas-covered {
    max-width: 250px;
  }
}

/* ─── Mode Toggle ─── */
.mode-toggle-btn {
  transition: all 0.2s ease;
  user-select: none;
}
.mode-toggle-btn:hover {
  transform: translateY(-1px);
}

/* International table columns */
.locations-table[data-mode="international"] td {
  word-break: break-word;
}

/* ─── Horizontal Fade Animations ─── */
@keyframes fadeRight {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.fade-right {
  opacity: 0;
  animation: fadeRight 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fade-left {
  opacity: 0;
  animation: fadeLeft 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}


/* ─── Vertical Fade Animation ─── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  opacity: 0;
  animation: fadeUp 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

@media (min-width: 1600px) {
  .locations-shell {
    max-width: calc(100vw - 120px);
  }
}

@media (min-width: 1920px) {
  .locations-shell {
    max-width: calc(100vw - 160px);
  }
}
