/* Important Numbers Page Specific Styles */
:root {
  --primary-color: #1a5276;
  --secondary-color: #d4ac0d;
  --accent-color: #e74c3c;
  --light-bg: #f8f9fa;
  --dark-text: #2c3e50;
}

/* Keyframe Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 8px 25px rgba(26, 82, 118, 0.3);
  }
  100% {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.contacts-page-body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--dark-text);
  background-color: var(--light-bg);
}

.section-title {
  color: var(--primary-color);
  border-bottom: 3px solid var(--secondary-color);
  padding-bottom: 10px;
  margin-bottom: 25px;
  font-weight: 700;
}

.section-subtitle {
  color: var(--primary-color);
  border-left: 4px solid var(--secondary-color);
  padding-left: 15px;
  margin-bottom: 20px;
  font-weight: 600;
  animation: slideInLeft 0.8s ease-out;
}

section {
  animation: fadeInUp 0.6s ease-out;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 40px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9ecef;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
  transition: width 0.4s ease;
}

section:hover {
  box-shadow: 0 12px 35px rgba(26, 82, 118, 0.12);
  transform: translateY(-5px);
}

section:hover::before {
  width: 8px;
}

section h4 {
  animation: slideInLeft 0.7s ease-out;
  position: relative;
  display: inline-block;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 24px;
  margin-bottom: 25px;
  padding-bottom: 15px;
}

section h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
  transition: width 0.5s ease;
  border-radius: 2px;
}

section:hover h4::after {
  width: 100%;
}

section h4::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -15px;
  width: 8px;
  height: 8px;
  background: var(--secondary-color);
  border-radius: 50%;
  transform: translateY(-50%);
  animation: pulse 2s infinite;
}

.emergency-card {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border-radius: 10px;
  transition: all 0.4s ease;
  border: none;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
  animation: fadeInUp 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.emergency-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.6s;
}

.emergency-card:hover::before {
  left: 100%;
}

.emergency-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 8px 25px rgba(231, 76, 60, 0.5);
}

.emergency-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  animation: bounceIn 1s ease-out;
  transition: transform 0.3s ease;
}

.emergency-card:hover .emergency-icon {
  transform: scale(1.2) rotate(5deg);
  animation: pulse 1s infinite;
}

.contacts-search-container {
  position: relative;
  max-width: 600px;
  margin: 30px auto;
  animation: bounceIn 0.8s ease-out;
}

.contacts-search-box {
  background: white;
  border-radius: 50px;
  padding: 5px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.contacts-search-box:hover {
  box-shadow: 0 8px 25px rgba(26, 82, 118, 0.2);
  transform: translateY(-2px);
}

.contacts-search-box:focus-within {
  animation: pulse 2s infinite;
}

.contacts-search-input-group {
  display: flex;
  align-items: center;
  padding: 0 15px;
}

.contacts-search-icon {
  color: var(--primary-color);
  margin-right: 10px;
  font-size: 18px;
}

.contacts-search-input {
  border: none;
  outline: none;
  flex: 1;
  padding: 12px 0;
  font-size: 16px;
  background: transparent;
  transition: all 0.3s ease;
}

.contacts-search-input::placeholder {
  transition: all 0.3s ease;
}

.contacts-search-input:focus::placeholder {
  opacity: 0.5;
  transform: translateX(5px);
}

.contacts-clear-search {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.3s ease;
  animation: fadeInRight 0.3s ease-out;
}

.contacts-clear-search:hover {
  background: #f0f0f0;
  color: var(--accent-color);
  transform: rotate(90deg);
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.contacts-search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  margin-top: 10px;
  overflow: hidden;
  display: none;
  animation: fadeInDown 0.3s ease-out;
}

.contacts-search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--light-bg);
  border-bottom: 1px solid #eee;
}

.contacts-close-results {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 18px;
}

.contacts-search-results-body {
  max-height: 400px;
  overflow-y: auto;
}

.contacts-search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  animation: fadeInUp 0.4s ease-out forwards;
}

.contacts-search-result-item:nth-child(1) { animation-delay: 0.1s; }
.contacts-search-result-item:nth-child(2) { animation-delay: 0.15s; }
.contacts-search-result-item:nth-child(3) { animation-delay: 0.2s; }
.contacts-search-result-item:nth-child(4) { animation-delay: 0.25s; }
.contacts-search-result-item:nth-child(5) { animation-delay: 0.3s; }

.contacts-search-result-item:hover {
  background: #f8f9fa;
  transform: translateX(5px);
  border-left: 3px solid var(--primary-color);
}

.contacts-result-content {
  flex: 1;
}

.contacts-result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 5px;
}

.contacts-result-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-text);
}

.contacts-result-category {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--light-bg);
  color: var(--primary-color);
  transition: all 0.3s ease;
  animation: fadeInDown 0.5s ease-out;
}

.contacts-search-result-item:hover .contacts-result-category {
  transform: scale(1.1);
}

.contacts-result-category.emergency {
  background: #ffeaea;
  color: var(--accent-color);
}

.contacts-result-category.medical {
  background: #e8f4fd;
  color: #3498db;
}

.contacts-result-category.government {
  background: #e8f5e9;
  color: #27ae60;
}

.contacts-result-contact {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.contacts-result-description {
  margin: 5px 0 0;
  font-size: 13px;
  color: #888;
}

.contacts-result-arrow {
  color: #ccc;
  font-size: 14px;
  transition: all 0.3s ease;
}

.contacts-search-result-item:hover .contacts-result-arrow {
  color: var(--primary-color);
  transform: translateX(5px);
}

.contacts-no-results {
  padding: 40px 20px;
  text-align: center;
  color: #999;
  animation: fadeInUp 0.5s ease-out;
}

.contacts-no-results-icon {
  font-size: 40px;
  margin-bottom: 15px;
  color: #ddd;
  animation: bounceIn 0.8s ease-out;
}

/* Enhanced Table Styling with Box Design */
.table-responsive {
  animation: fadeInUp 0.6s ease-out;
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 30px;
}

.table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.contacts-table th {
  background: linear-gradient(135deg, var(--primary-color), #2471a3);
  color: white;
  border: none;
  position: relative;
  overflow: hidden;
  padding: 18px 15px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.contacts-table th:first-child {
  border-top-left-radius: 10px;
}

.contacts-table th:last-child {
  border-top-right-radius: 10px;
}

.contacts-table th::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.6s ease;
}

.contacts-table th:hover::before {
  left: 100%;
}

/* Column-specific animations */
.contacts-table th:nth-child(1) {
  animation: slideInLeft 0.5s ease-out;
  animation-delay: 0.1s;
  animation-fill-mode: both;
}

.contacts-table th:nth-child(2) {
  animation: fadeInDown 0.5s ease-out;
  animation-delay: 0.2s;
  animation-fill-mode: both;
}

.contacts-table th:nth-child(3) {
  animation: fadeInDown 0.5s ease-out;
  animation-delay: 0.3s;
  animation-fill-mode: both;
}

.contacts-table th:nth-child(4) {
  animation: slideInRight 0.5s ease-out;
  animation-delay: 0.4s;
  animation-fill-mode: both;
}

.contacts-table th:nth-child(5) {
  animation: slideInRight 0.5s ease-out;
  animation-delay: 0.5s;
  animation-fill-mode: both;
}

.contacts-table td {
  vertical-align: middle;
  transition: all 0.3s ease;
  padding: 15px;
  border: 1px solid #e9ecef;
  background: white;
  position: relative;
}

/* Column hover effects */
.contacts-table td:nth-child(1) {
  font-weight: 600;
  color: var(--primary-color);
  background: linear-gradient(to right, #f8f9fa 0%, white 100%);
}

.contacts-table td:nth-child(2) {
  font-weight: 500;
  text-align: left;
}

.contacts-table td:nth-child(3) {
  color: #27ae60;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.contacts-table td:nth-child(4) {
  text-align: left;
  color: #555;
  font-size: 14px;
}

/* Individual cell hover animation */
.contacts-table td:hover {
  background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
  transform: scale(1.02);
  box-shadow: inset 0 0 10px rgba(26, 82, 118, 0.1);
  z-index: 1;
}

/* Row animations */
.contacts-table tbody tr {
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
  transition: all 0.3s ease;
  border-radius: 8px;
}

.contacts-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.contacts-table tbody tr:nth-child(2) { animation-delay: 0.15s; }
.contacts-table tbody tr:nth-child(3) { animation-delay: 0.2s; }
.contacts-table tbody tr:nth-child(4) { animation-delay: 0.25s; }
.contacts-table tbody tr:nth-child(5) { animation-delay: 0.3s; }
.contacts-table tbody tr:nth-child(n+6) { animation-delay: 0.35s; }

.contacts-table tbody tr:hover {
  background: linear-gradient(to right, #e8f4f8 0%, #f0f7ff 100%);
  transform: translateX(5px);
  box-shadow: -5px 0 15px rgba(26, 82, 118, 0.15);
}

.contacts-table tbody tr:hover td {
  border-color: #b3d9f2;
}

/* Alternating row colors with animation */
.contacts-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.contacts-table tbody tr:nth-child(odd) {
  background: white;
}

/* Loading Animation */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--light-bg);
  border-top: 5px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Scroll to top button animation */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(26, 82, 118, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  animation: bounceIn 0.5s ease-out;
}

.scroll-to-top:hover {
  background: var(--secondary-color);
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(26, 82, 118, 0.4);
}

.scroll-to-top.show {
  display: flex;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .contacts-search-container {
    margin: 20px 15px;
  }

  .emergency-card {
    margin-bottom: 15px;
  }

  .contacts-table {
    font-size: 14px;
  }
  
  /* Reduce animation intensity on mobile */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(15px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .contacts-table tbody tr:hover {
    transform: scale(1);
  }
  
  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
}


/* Contact Number Animation */
.contacts-table td:nth-child(3)::before {
  content: '📞';
  margin-right: 8px;
  display: inline-block;
  animation: ring 2s ease-in-out infinite;
}

@keyframes ring {
  0%, 100% {
    transform: rotate(0deg);
  }
  10%, 30% {
    transform: rotate(-10deg);
  }
  20%, 40% {
    transform: rotate(10deg);
  }
}

/* Serial Number Badge Style */
.contacts-table td:nth-child(1) {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  font-weight: 700;
  color: var(--primary-color);
  min-width: 60px;
  position: relative;
}

.contacts-table td:nth-child(1)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-color);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contacts-table tr:hover td:nth-child(1)::after {
  opacity: 1;
}

/* Name Column with Icon */
.contacts-table td:nth-child(2) {
  position: relative;
  padding-left: 40px;
}

.contacts-table td:nth-child(2)::before {
  content: '👤';
  position: absolute;
  left: 15px;
  opacity: 0;
  transition: all 0.3s ease;
  transform: scale(0);
}

.contacts-table tr:hover td:nth-child(2)::before {
  opacity: 1;
  transform: scale(1);
}

/* Address Column with Location Icon */
.contacts-table td:nth-child(4)::before {
  content: '📍';
  margin-right: 8px;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.contacts-table tr:hover td:nth-child(4)::before {
  opacity: 1;
  transform: scale(1.2);
}

/* Box Shadow Animation on Scroll */
@keyframes boxGlow {
  0%, 100% {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  }
  50% {
    box-shadow: 0 8px 30px rgba(26, 82, 118, 0.15);
  }
}

.table-responsive:hover {
  animation: boxGlow 2s ease-in-out infinite;
}

/* Column Divider Animation */
.contacts-table td {
  position: relative;
}

.contacts-table td:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, #dee2e6, transparent);
  opacity: 0.5;
}

/* ========== MOBILE RESPONSIVE DESIGN ========== */

/* Tablet Devices */
@media (max-width: 992px) {
  .container {
    padding: 0 15px;
  }
  
  section {
    padding: 25px 20px;
    margin-bottom: 30px !important;
  }
  
  section h4 {
    font-size: 22px;
    margin-bottom: 20px;
  }
  
  .table-responsive {
    padding: 15px;
  }
  
  .contacts-table th,
  .contacts-table td {
    padding: 12px 10px;
    font-size: 14px;
  }
}

/* Mobile Devices */
@media (max-width: 768px) {
  /* Disable heavy animations on mobile */
  * {
    animation-duration: 0.3s !important;
  }
  
  /* Container adjustments */
  .container {
    padding: 0 10px;
  }
  
  /* Section styling */
  section {
    padding: 20px 15px;
    border-radius: 12px;
    margin-bottom: 25px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  }
  
  section::before {
    width: 4px;
  }
  
  section:hover::before {
    width: 4px;
  }
  
  section h4 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
  }
  
  section h4::before {
    left: -10px;
    width: 6px;
    height: 6px;
  }
  
  /* Table responsive */
  .table-responsive {
    padding: 10px;
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Table styling */
  .contacts-table {
    font-size: 13px;
    min-width: 100%;
  }
  
  .contacts-table th,
  .contacts-table td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }
  
  /* Column widths for mobile */
  .contacts-table th:nth-child(1),
  .contacts-table td:nth-child(1) {
    width: 40px;
    min-width: 40px;
  }
  
  .contacts-table th:nth-child(2),
  .contacts-table td:nth-child(2) {
    min-width: 180px;
    white-space: normal;
  }
  
  .contacts-table th:nth-child(3),
  .contacts-table td:nth-child(3) {
    min-width: 120px;
  }
  
  .contacts-table th:nth-child(4),
  .contacts-table td:nth-child(4) {
    min-width: 200px;
    white-space: normal;
  }
  
  /* Remove decorative icons on mobile */
  .contacts-table td:nth-child(2)::before,
  .contacts-table td:nth-child(3)::before,
  .contacts-table td:nth-child(4)::before {
    display: none;
  }
  
  .contacts-table td:nth-child(2) {
    padding-left: 8px;
  }
  
  /* Simplify hover effects */
  .contacts-table tbody tr:hover {
    transform: none;
    box-shadow: none;
    background: #f0f7ff;
  }
  
  .contacts-table td:hover {
    transform: none;
    box-shadow: none;
  }
  
  /* Search box mobile */
  .contacts-search-container {
    margin: 20px 10px;
    max-width: 100%;
  }
  
  .contacts-search-box {
    border-radius: 30px;
  }
  
  .contacts-search-input {
    font-size: 14px;
    padding: 10px 0;
  }
  
  .contacts-search-input::placeholder {
    font-size: 13px;
  }
  
  /* Search results mobile */
  .contacts-search-results-dropdown {
    border-radius: 8px;
    margin-top: 8px;
  }
  
  .contacts-search-result-item {
    padding: 12px 15px;
  }
  
  .contacts-result-title {
    font-size: 14px;
  }
  
  .contacts-result-contact {
    font-size: 13px;
  }
  
  .contacts-result-description {
    font-size: 12px;
  }
  
  /* Scroll to top button */
  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  
  /* Disable complex animations */
  section::after,
  .table-responsive::before,
  .contacts-table tbody tr::after,
  .contacts-table td::after {
    display: none;
  }
  
  /* Simplify backgrounds */
  section {
    background: white;
    animation: none;
  }
  
  .contacts-table tbody tr {
    background: white;
    animation: fadeInUp 0.3s ease-out forwards;
  }
  
  .contacts-table tbody tr:nth-child(even) {
    background: #fafbfc;
  }
  
  /* Remove 3D effects */
  .table-responsive:hover {
    transform: none;
  }
  
  /* Subtitle mobile */
  .section-subtitle {
    font-size: 20px;
    padding-left: 12px;
    margin-bottom: 15px;
  }
  
  .section-subtitle::after {
    display: none;
  }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
  /* Further reduce sizes */
  section {
    padding: 15px 10px;
    border-radius: 10px;
  }
  
  section h4 {
    font-size: 16px;
    margin-bottom: 12px;
  }
  
  .table-responsive {
    padding: 8px;
    border-radius: 8px;
  }
  
  .contacts-table th,
  .contacts-table td {
    padding: 8px 6px;
    font-size: 11px;
  }
  
  .contacts-table th:nth-child(1),
  .contacts-table td:nth-child(1) {
    width: 35px;
    min-width: 35px;
  }
  
  .contacts-table th:nth-child(2),
  .contacts-table td:nth-child(2) {
    min-width: 150px;
  }
  
  .contacts-table th:nth-child(3),
  .contacts-table td:nth-child(3) {
    min-width: 110px;
  }
  
  .contacts-table th:nth-child(4),
  .contacts-table td:nth-child(4) {
    min-width: 180px;
  }
  
  /* Search mobile */
  .contacts-search-container {
    margin: 15px 5px;
  }
  
  .contacts-search-input {
    font-size: 13px;
  }
  
  .contacts-search-input::placeholder {
    font-size: 12px;
  }
  
  /* Subtitle */
  .section-subtitle {
    font-size: 18px;
    padding-left: 10px;
  }
  
  /* Scroll button */
  .scroll-to-top {
    bottom: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  /* Simplify all animations */
  * {
    animation: none !important;
    transition: all 0.2s ease !important;
  }
  
  .contacts-table tbody tr {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  section {
    padding: 15px;
  }
  
  .contacts-table th,
  .contacts-table td {
    padding: 8px 6px;
  }
  
  .scroll-to-top {
    bottom: 10px;
    right: 10px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .contacts-table tbody tr:hover,
  .contacts-table td:hover,
  section:hover,
  .table-responsive:hover {
    transform: none;
    box-shadow: none;
    animation: none;
  }
  
  /* Make touch targets larger */
  .contacts-table td {
    padding: 12px 10px;
  }
  
  .scroll-to-top {
    width: 50px;
    height: 50px;
  }
  
  /* Improve tap feedback */
  .contacts-table tbody tr:active {
    background: #e3f2fd;
  }
  
  .scroll-to-top:active {
    transform: scale(0.95);
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .contacts-table th,
  .contacts-table td {
    border-width: 0.5px;
  }
}

/* Print styles */
@media print {
  section {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .contacts-search-container,
  .scroll-to-top {
    display: none;
  }
  
  .contacts-table {
    font-size: 10pt;
  }
  
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Perfect Box Container */
.container {
  position: relative;
}

.container::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--primary-color), transparent);
  opacity: 0.3;
}


/* Card-Style Table Wrapper */
.table-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.table-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color), var(--primary-color));
  background-size: 200% 100%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Enhanced Section Title Box */
section h4 {
  background: linear-gradient(135deg, #f8f9fa 0%, white 100%);
  padding: 15px 25px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 10px;
  transition: all 0.3s ease;
}

section h4:hover {
  transform: translateX(10px);
  box-shadow: 0 5px 15px rgba(26, 82, 118, 0.15);
}

/* Floating Animation for Icons in Headers */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
}

section h4:hover {
  animation: float 2s ease-in-out infinite;
}

/* Data Cell Highlight Effect */
.contacts-table tbody tr td {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.contacts-table tbody tr td::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(26, 82, 118, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.contacts-table tbody tr td:hover::before {
  width: 200%;
  height: 200%;
}

/* Perfect Border Radius for Table */
.contacts-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 10px;
}

.contacts-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 10px;
}

/* Zebra Stripe Animation */
.contacts-table tbody tr:nth-child(even):hover {
  background: linear-gradient(to right, #e3f2fd 0%, #f0f7ff 50%, #e3f2fd 100%);
  background-size: 200% 100%;
  animation: stripeMove 3s linear infinite;
}

@keyframes stripeMove {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* Column Width Optimization */
.contacts-table th:nth-child(1),
.contacts-table td:nth-child(1) {
  width: 80px;
  text-align: center;
}

.contacts-table th:nth-child(2),
.contacts-table td:nth-child(2) {
  width: 30%;
  min-width: 200px;
}

.contacts-table th:nth-child(3),
.contacts-table td:nth-child(3) {
  width: 150px;
  text-align: center;
}

.contacts-table th:nth-child(4),
.contacts-table td:nth-child(4) {
  width: auto;
}

/* Smooth Scroll Padding for Sections */
section {
  scroll-margin-top: 100px;
}

/* Glass Morphism Effect for Table Headers */
.contacts-table thead {
  backdrop-filter: blur(10px);
  background: linear-gradient(135deg, rgba(26, 82, 118, 0.95), rgba(36, 113, 163, 0.95));
}

/* Pulse Effect on Contact Numbers */
.contacts-table td:nth-child(3):hover {
  animation: contactPulse 0.5s ease;
}

@keyframes contactPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}


/* ========== ADVANCED ANIMATIONS ========== */

/* 3D Flip Animation for Table Rows */
.contacts-table tbody tr {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.contacts-table tbody tr:hover {
  animation: flip3D 0.6s ease;
}

@keyframes flip3D {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(5deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

/* Wave Animation for Section Backgrounds */
section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px;
  background: linear-gradient(to top, rgba(26, 82, 118, 0.03), transparent);
  animation: wave 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes wave {
  0%, 100% {
    transform: translateX(0) translateY(0);
  }
  25% {
    transform: translateX(-20px) translateY(-5px);
  }
  50% {
    transform: translateX(0) translateY(-10px);
  }
  75% {
    transform: translateX(20px) translateY(-5px);
  }
}

/* Particle Effect on Section Hover */
section:hover::after {
  animation: wave 3s ease-in-out infinite, particleFloat 4s ease-in-out infinite;
}

@keyframes particleFloat {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

/* Neon Glow Effect for Headers */
section h4 {
  text-shadow: 0 0 10px rgba(26, 82, 118, 0);
  transition: text-shadow 0.3s ease;
}

section:hover h4 {
  text-shadow: 
    0 0 10px rgba(26, 82, 118, 0.5),
    0 0 20px rgba(26, 82, 118, 0.3),
    0 0 30px rgba(26, 82, 118, 0.1);
  animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
  0%, 100% {
    text-shadow: 
      0 0 10px rgba(26, 82, 118, 0.5),
      0 0 20px rgba(26, 82, 118, 0.3);
  }
  50% {
    text-shadow: 
      0 0 20px rgba(26, 82, 118, 0.8),
      0 0 30px rgba(26, 82, 118, 0.5),
      0 0 40px rgba(26, 82, 118, 0.3);
  }
}

/* Typewriter Effect for Table Headers */
.contacts-table th {
  overflow: hidden;
  white-space: nowrap;
  animation: typewriter 1s steps(20) forwards;
}

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Rainbow Border Animation */
.table-responsive {
  position: relative;
  border: 2px solid transparent;
  background: 
    linear-gradient(white, white) padding-box,
    linear-gradient(45deg, #1a5276, #d4ac0d, #e74c3c, #1a5276) border-box;
  animation: rainbowRotate 4s linear infinite;
}

@keyframes rainbowRotate {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

/* Bounce Animation for Serial Numbers */
.contacts-table td:nth-child(1) {
  animation: bounceNumber 2s ease-in-out infinite;
}

@keyframes bounceNumber {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* Slide and Fade for Contact Numbers */
.contacts-table td:nth-child(3) {
  animation: slideContact 3s ease-in-out infinite;
}

@keyframes slideContact {
  0%, 100% {
    transform: translateX(0);
    opacity: 1;
  }
  50% {
    transform: translateX(5px);
    opacity: 0.8;
  }
}

/* Rotating Border for Table */
.table-responsive::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #1a5276, #d4ac0d, #e74c3c, #27ae60);
  border-radius: 17px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  animation: rotateBorder 4s linear infinite;
}

.table-responsive:hover::before {
  opacity: 0.3;
}

@keyframes rotateBorder {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Shake Animation for Icons */
section h4:hover::before {
  animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% {
    transform: translateY(-50%) rotate(0deg);
  }
  25% {
    transform: translateY(-50%) rotate(-5deg);
  }
  75% {
    transform: translateY(-50%) rotate(5deg);
  }
}

/* Zoom In/Out Animation for Rows */
.contacts-table tbody tr {
  animation: zoomInOut 10s ease-in-out infinite;
}

@keyframes zoomInOut {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.002);
  }
}

/* Gradient Text Animation for Headers */
section h4 {
  background: linear-gradient(45deg, #1a5276, #d4ac0d, #e74c3c, #1a5276);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientText 5s ease infinite;
}

@keyframes gradientText {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Spotlight Effect on Hover */
.contacts-table tbody tr {
  position: relative;
  overflow: hidden;
}

.contacts-table tbody tr::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: left 0.5s ease;
}

.contacts-table tbody tr:hover::after {
  left: 100%;
}

/* Pulsating Dots Animation */
.contacts-table td::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  background: var(--secondary-color);
  border-radius: 50%;
  opacity: 0;
  animation: pulseDot 2s ease-in-out infinite;
}

.contacts-table tr:hover td::after {
  opacity: 1;
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Morphing Background */
section {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #e8f4f8 100%);
  background-size: 200% 200%;
  animation: morphBackground 10s ease infinite;
}

@keyframes morphBackground {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Elastic Bounce for Search Box */
.contacts-search-box:focus-within {
  animation: elasticBounce 0.8s ease;
}

@keyframes elasticBounce {
  0%, 100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(0.98);
  }
  70% {
    transform: scale(1.02);
  }
}

/* Search Icon - Static */
.contacts-search-icon {
  transition: color 0.3s ease;
}

.contacts-search-input:focus ~ .contacts-search-icon {
  color: var(--secondary-color);
}

/* Glitch Effect for Section Numbers */
.contacts-table td:nth-child(1):hover {
  animation: glitch 0.3s ease;
}

@keyframes glitch {
  0%, 100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
}

/* Breathing Animation for Container */
.container {
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.005);
  }
}

/* Ripple Effect on Click */
.contacts-table td {
  position: relative;
  overflow: hidden;
}

.contacts-table td:active::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(26, 82, 118, 0.3);
  transform: translate(-50%, -50%);
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* Floating Particles Background */
section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(26, 82, 118, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(212, 172, 13, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(231, 76, 60, 0.03) 0%, transparent 50%);
  animation: floatParticles 15s ease-in-out infinite;
  pointer-events: none;
}

@keyframes floatParticles {
  0%, 100% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(10px, -10px);
  }
  66% {
    transform: translate(-10px, 10px);
  }
}

/* Magnetic Effect for Buttons */
.scroll-to-top {
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.scroll-to-top:hover {
  animation: magnetic 0.5s ease-in-out infinite;
}

@keyframes magnetic {
  0%, 100% {
    transform: translateY(-5px) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.1);
  }
}

/* Cascade Animation for Multiple Sections */
section:nth-child(1) { animation-delay: 0s; }
section:nth-child(2) { animation-delay: 0.1s; }
section:nth-child(3) { animation-delay: 0.2s; }
section:nth-child(4) { animation-delay: 0.3s; }
section:nth-child(5) { animation-delay: 0.4s; }
section:nth-child(6) { animation-delay: 0.5s; }
section:nth-child(7) { animation-delay: 0.6s; }
section:nth-child(8) { animation-delay: 0.7s; }

/* Tilt Effect on Hover */
.table-responsive:hover {
  transform: perspective(1000px) rotateX(2deg);
  transition: transform 0.5s ease;
}

/* Color Shift Animation */
.contacts-table tbody tr:hover td:nth-child(3) {
  animation: colorShift 2s ease infinite;
}

@keyframes colorShift {
  0%, 100% {
    color: #27ae60;
  }
  33% {
    color: #3498db;
  }
  66% {
    color: #e74c3c;
  }
}

/* Expand Animation for Address Column */
.contacts-table td:nth-child(4):hover {
  animation: expand 0.5s ease;
}

@keyframes expand {
  0%, 100% {
    letter-spacing: 0;
  }
  50% {
    letter-spacing: 1px;
  }
}


/* Sparkle Animation */
@keyframes sparkleAnim {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.5) rotate(180deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

/* Confetti Effect on Section Load */
@keyframes confetti {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Liquid Animation for Borders */
.table-responsive {
  border-image: linear-gradient(45deg, #1a5276, #d4ac0d, #e74c3c, #27ae60) 1;
  animation: liquidBorder 5s ease-in-out infinite;
}

@keyframes liquidBorder {
  0%, 100% {
    border-image-slice: 1;
  }
  50% {
    border-image-slice: 2;
  }
}

/* Heartbeat Animation for Important Numbers */
.contacts-table td:nth-child(3) {
  animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  10%, 30% {
    transform: scale(1.05);
  }
  20%, 40% {
    transform: scale(1);
  }
}

/* Slide In from Sides for Columns */
.contacts-table td:nth-child(1) {
  animation: slideInFromLeft 0.6s ease-out;
}

.contacts-table td:nth-child(4) {
  animation: slideInFromRight 0.6s ease-out;
}

@keyframes slideInFromLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Glow Pulse for Search Box */
.contacts-search-box {
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 5px 25px rgba(26, 82, 118, 0.3), 0 0 30px rgba(26, 82, 118, 0.1);
  }
}

/* Typewriter Cursor Effect */
.section-subtitle::after {
  content: '|';
  animation: blink 1s step-end infinite;
  margin-left: 5px;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Rotate and Scale on Hover */
.contacts-table tbody tr:hover {
  animation: rotateScale 0.5s ease;
}

@keyframes rotateScale {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(0.5deg) scale(1.01);
  }
}

/* Gradient Border Animation */
.table-responsive {
  position: relative;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(90deg, #1a5276, #d4ac0d, #e74c3c, #27ae60, #1a5276) border-box;
  border: 3px solid transparent;
  background-size: 100% 100%, 300% 100%;
  animation: gradientBorderMove 5s linear infinite;
}

@keyframes gradientBorderMove {
  0% {
    background-position: 0% 0%, 0% 0%;
  }
  100% {
    background-position: 0% 0%, 300% 0%;
  }
}

/* Bounce In Animation for Icons */
section h4::before {
  animation: bounceIn 1s ease-out, pulse 2s ease-in-out infinite 1s;
}

/* Swing Animation for Hover */
.contacts-table tbody tr:hover {
  animation: swing 0.6s ease;
}

@keyframes swing {
  20% {
    transform: rotate(2deg);
  }
  40% {
    transform: rotate(-1deg);
  }
  60% {
    transform: rotate(0.5deg);
  }
  80% {
    transform: rotate(-0.25deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Zoom Blur Effect */
.contacts-table tbody tr:hover td {
  animation: zoomBlur 0.3s ease;
}

@keyframes zoomBlur {
  0% {
    filter: blur(0px);
    transform: scale(1);
  }
  50% {
    filter: blur(1px);
    transform: scale(1.02);
  }
  100% {
    filter: blur(0px);
    transform: scale(1);
  }
}

/* Flip Card Effect for Cells */
.contacts-table td {
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.contacts-table td:active {
  transform: rotateY(180deg);
}

/* Meteor Shower Effect */
section::before {
  animation: floatParticles 15s ease-in-out infinite, meteorShower 20s linear infinite;
}

@keyframes meteorShower {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

/* Elastic Stretch */
.contacts-table tbody tr:hover {
  animation: elasticStretch 0.8s ease;
}

@keyframes elasticStretch {
  0%, 100% {
    transform: scaleX(1);
  }
  30% {
    transform: scaleX(1.02);
  }
  60% {
    transform: scaleX(0.99);
  }
}

/* Color Wave Effect */
.contacts-table tbody tr {
  background: linear-gradient(90deg, 
    white 0%, 
    #f8f9fa 25%, 
    white 50%, 
    #f8f9fa 75%, 
    white 100%);
  background-size: 200% 100%;
  animation: colorWave 8s linear infinite;
}

@keyframes colorWave {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* Jello Animation */
.contacts-table td:nth-child(1):hover {
  animation: jello 0.8s ease;
}

@keyframes jello {
  0%, 100% {
    transform: skewX(0deg) skewY(0deg);
  }
  30% {
    transform: skewX(-12.5deg) skewY(-12.5deg);
  }
  40% {
    transform: skewX(6.25deg) skewY(6.25deg);
  }
  50% {
    transform: skewX(-3.125deg) skewY(-3.125deg);
  }
  65% {
    transform: skewX(1.5625deg) skewY(1.5625deg);
  }
  75% {
    transform: skewX(-0.78125deg) skewY(-0.78125deg);
  }
}

/* Fade In Scale */
.contacts-table tbody tr {
  animation: fadeInScale 0.6s ease-out forwards;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Light Speed Effect */
.contacts-table tbody tr:hover {
  animation: lightSpeed 0.5s ease-out;
}

@keyframes lightSpeed {
  0% {
    transform: translateX(0) skewX(0deg);
  }
  60% {
    transform: translateX(10px) skewX(-20deg);
    opacity: 1;
  }
  80% {
    transform: translateX(-5px) skewX(5deg);
  }
  100% {
    transform: translateX(0) skewX(0deg);
  }
}

/* Rubber Band Effect */
.contacts-table td:nth-child(3):hover {
  animation: rubberBand 0.8s ease;
}

@keyframes rubberBand {
  0%, 100% {
    transform: scale(1);
  }
  30% {
    transform: scaleX(1.25) scaleY(0.75);
  }
  40% {
    transform: scaleX(0.75) scaleY(1.25);
  }
  50% {
    transform: scaleX(1.15) scaleY(0.85);
  }
  65% {
    transform: scaleX(0.95) scaleY(1.05);
  }
  75% {
    transform: scaleX(1.05) scaleY(0.95);
  }
}

/* Tada Animation */
section:hover {
  animation: tada 1s ease;
}

@keyframes tada {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  10%, 20% {
    transform: scale(0.99) rotate(-2deg);
  }
  30%, 50%, 70%, 90% {
    transform: scale(1.01) rotate(2deg);
  }
  40%, 60%, 80% {
    transform: scale(1.01) rotate(-2deg);
  }
}

/* Wobble Effect */
.scroll-to-top:hover {
  animation: wobble 0.8s ease;
}

@keyframes wobble {
  0%, 100% {
    transform: translateX(0);
  }
  15% {
    transform: translateX(-10px) rotate(-5deg);
  }
  30% {
    transform: translateX(8px) rotate(3deg);
  }
  45% {
    transform: translateX(-6px) rotate(-3deg);
  }
  60% {
    transform: translateX(4px) rotate(2deg);
  }
  75% {
    transform: translateX(-2px) rotate(-1deg);
  }
}


/* ========== MOBILE CARD VIEW (Alternative Layout) ========== */

/* Mobile Card Layout for very small screens */
@media (max-width: 576px) {
  /* Option to show data as cards instead of table */
  .table-responsive.card-view {
    padding: 0;
  }
  
  .table-responsive.card-view .contacts-table thead {
    display: none;
  }
  
  .table-responsive.card-view .contacts-table,
  .table-responsive.card-view .contacts-table tbody,
  .table-responsive.card-view .contacts-table tr {
    display: block;
    width: 100%;
  }
  
  .table-responsive.card-view .contacts-table tr {
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }
  
  .table-responsive.card-view .contacts-table td {
    display: block;
    width: 100%;
    text-align: left !important;
    padding: 8px 0;
    border: none;
    white-space: normal;
  }
  
  .table-responsive.card-view .contacts-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--primary-color);
    display: inline-block;
    width: 80px;
    margin-right: 10px;
  }
  
  .table-responsive.card-view .contacts-table td:nth-child(1) {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  
  .table-responsive.card-view .contacts-table td:nth-child(1)::before {
    content: '📋 क्र. ';
  }
  
  .table-responsive.card-view .contacts-table td:nth-child(2)::before {
    content: '👤 नाव: ';
  }
  
  .table-responsive.card-view .contacts-table td:nth-child(3)::before {
    content: '📞 संपर्क: ';
  }
  
  .table-responsive.card-view .contacts-table td:nth-child(4)::before {
    content: '📍 पत्ता: ';
  }
}

/* Swipe Indicator Animation */
@keyframes swipeHint {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(10px);
  }
}

.swipe-indicator {
  animation: swipeHint 2s ease-in-out infinite;
}

/* Mobile Loading Spinner */
.mobile-loading {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
}

@media (max-width: 768px) {
  .mobile-loading {
    display: block;
  }
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  body {
    -webkit-tap-highlight-color: rgba(26, 82, 118, 0.1);
  }
}

/* Mobile Table Scroll Shadow */
@media (max-width: 768px) {
  .table-responsive {
    background:
      linear-gradient(to right, white 30%, rgba(255,255,255,0)),
      linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
      radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.2), rgba(0,0,0,0)),
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;
    background-repeat: no-repeat;
    background-color: white;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-position: 0 0, 100%, 0 0, 100%;
    background-attachment: local, local, scroll, scroll;
  }
}

/* Mobile Sticky Header */
@media (max-width: 768px) {
  .contacts-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

/* Mobile Touch Feedback */
@media (max-width: 768px) {
  .contacts-table tbody tr:active {
    background: linear-gradient(to right, #e3f2fd, #f0f7ff);
    transform: scale(0.98);
  }
  
  .scroll-to-top:active {
    transform: scale(0.9);
    background: var(--secondary-color);
  }
  
  .contacts-search-box:active {
    transform: scale(0.98);
  }
}

/* Mobile Safe Area (for notched devices) */
@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    .container {
      padding-left: max(10px, env(safe-area-inset-left));
      padding-right: max(10px, env(safe-area-inset-right));
    }
    
    .scroll-to-top {
      bottom: max(20px, env(safe-area-inset-bottom));
      right: max(20px, env(safe-area-inset-right));
    }
  }
}

/* Mobile Dark Mode Support */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
  section {
    background: #1a1a1a;
    color: #e0e0e0;
    border-color: #333;
  }
  
  .contacts-table {
    background: #1a1a1a;
    color: #e0e0e0;
  }
  
  .contacts-table tbody tr:nth-child(even) {
    background: #222;
  }
  
  .contacts-table tbody tr:nth-child(odd) {
    background: #1a1a1a;
  }
  
  .contacts-table td {
    border-color: #333;
  }
  
  .contacts-search-box {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  
  .contacts-search-input {
    color: #e0e0e0;
  }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile Performance Optimization */
@media (max-width: 768px) {
  * {
    will-change: auto !important;
  }
  
  .contacts-table tbody tr {
    contain: layout style paint;
  }
  
  section {
    contain: layout style;
  }
}
