/* ========================================
   AUTOMATION PRODUCTS STYLES - COMPLETE & UPDATED
   ======================================== */

/* Automation Tabs Navigation - CLEAN NO BACKGROUND */
.automation-tabs-container {
  margin-bottom: 4rem;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
}

.automation-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2rem;
  background: none;
  padding: 2rem 0;
  border-radius: 0;
  backdrop-filter: none;
  border: none;
  box-shadow: none;
  max-width: 1200px;
  width: 100%;
}

/* PERFECT 1:1 CONTAINER BUTTONS - FIXED PROXIMITY SENSOR WHITE COLOR */
.automation-tab {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 2.5rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  color: #64748b;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: 180px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.automation-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* TAB ICONS - GENERAL STYLING */
.automation-tab .tab-icon {
  font-size: 2.8rem;
  transition: all 0.3s ease;
  z-index: 1;
  position: relative;
  color: #94a3b8;
}

/* PROXIMITY SENSOR ICON - LARGER SIZE AND PROPER WHITE COLOR WHEN ACTIVE */
.automation-tab[data-category="proximity-sensors"] img.tab-icon {
  width: 3rem !important;
  height: 3rem !important;
  transition: all 0.3s ease;
  cursor: pointer;
}

/* NON-ACTIVE PROXIMITY SENSOR - GREY COLOR */
.automation-tab[data-category="proximity-sensors"]:not(.active) img.tab-icon {
  filter: grayscale(1) opacity(0.6) brightness(0.7) !important;
}

/* ACTIVE PROXIMITY SENSOR - WHITE COLOR (FIXED) */
.automation-tab[data-category="proximity-sensors"].active img.tab-icon {
  filter: brightness(0) invert(1) !important; /* PROPER WHITE COLOR */
}

/* HOVER STATE FOR PROXIMITY SENSOR */
.automation-tab[data-category="proximity-sensors"]:hover img.tab-icon {
  filter: brightness(0) invert(1) !important; /* WHITE ON HOVER */
}

/* OTHER ICONS - REGULAR STYLING */
.automation-tab:not([data-category="proximity-sensors"]) .tab-icon {
  font-size: 2.8rem;
}

/* NON-ACTIVE OTHER ICONS - GREY */
.automation-tab:not([data-category="proximity-sensors"]):not(.active) .tab-icon {
  color: #94a3b8;
}

/* ACTIVE OTHER ICONS - WHITE */
.automation-tab:not([data-category="proximity-sensors"]).active .tab-icon {
  color: white;
}

/* HOVER STATES FOR OTHER ICONS */
.automation-tab:not([data-category="proximity-sensors"]):hover .tab-icon {
  color: white;
}

.automation-tab span {
  z-index: 1;
  position: relative;
  text-align: center;
  line-height: 1.3;
  font-size: 1rem;
  font-weight: 600;
}

.automation-tab:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.2);
}

.automation-tab:hover::before {
  opacity: 1;
}

.automation-tab:hover span {
  color: white;
}

.automation-tab.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 16px 36px rgba(59, 130, 246, 0.4);
  border-color: rgba(59, 130, 246, 0.3);
}

.automation-tab.active span {
  color: white;
}

/* Category Content Container */
.automation-content-container {
  position: relative;
  min-height: 600px;
  background: none;
}

.automation-category-content {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.automation-category-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Category Header */
.category-header {
  text-align: center;
  margin-bottom: 5rem;
  padding: 0 2rem;
}

.category-title {
  font-size: 2.8rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.2rem;
  text-shadow: none;
}

.category-description {
  color: #64748b;
  font-size: 1.3rem;
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
}

/* Products Grid */
.automation-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  background: none;
  align-items: stretch;
}

/* Product Card Styles - WITH IMAGES */
.automation-product-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.automation-product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
  transform: scaleX(0);
  transition: transform 0.4s ease;
  transform-origin: left;
}

.automation-product-card:hover {
  transform: translateY(-12px);
  box-shadow: 0 24px 60px rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.2);
}

.automation-product-card:hover::before {
  transform: scaleX(1);
}

/* Product Images - UPDATED */
.product-image-container {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 20px 20px 0 0;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.automation-product-card:hover .product-image {
  transform: scale(1.05);
}

/* Product Content - FIXED LAYOUT */
.product-content {
  padding: 2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-info {
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.product-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.8rem;
  line-height: 1.3;
}

.product-specs {
  color: #64748b;
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
  line-height: 1.5;
}

/* Badges - UPDATED STYLING */
.product-variants, .product-brand, .product-status {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 25px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.product-variants {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.product-brand {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.product-status {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

/* Button - FIXED TEXT ALIGNMENT */
.product-details-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  margin-top: auto;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  min-height: 48px;
}

.product-details-btn::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 ease;
}

.product-details-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.product-details-btn:hover::before {
  left: 100%;
}

/* Modal Styles - FIXED POSITIONING */
.automation-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 2rem;
  box-sizing: border-box;
}

.automation-modal-backdrop.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.automation-modal-content {
  background: white;
  border-radius: 24px;
  max-width: 900px;
  width: 100%;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  position: relative;
  transform: scale(0.8);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  margin: auto;
}

.automation-modal-backdrop.active .automation-modal-content {
  transform: scale(1);
}

.automation-modal-close {
  position: absolute;
  top: 1.3rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.9) !important; /* Whitish background */
  border: 2px solid rgba(240, 240, 240, 0.8) !important; /* Light border */
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  color: #333333 !important; /* Dark X on white background */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important; /* Subtle shadow */
}

.automation-modal-close:hover {
  background: rgba(248, 248, 248, 1) !important; /* Pure whitish on hover */
  color: #666666 !important; /* Slightly lighter X on hover */
  transform: scale(1.1) rotate(90deg) !important; /* Adds rotation effect */
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important; /* Enhanced shadow */
  border-color: rgba(220, 220, 220, 1) !important;
}

.automation-modal-body {
  padding: 3rem;
}

.modal-product-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.modal-product-description {
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 2rem;
  text-align: center;
  font-size: 1.2rem;
}

/* Variants Table */
.variants-table-container {
  background: #f8fafc;
  border-radius: 20px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  border: 1px solid #e2e8f0;
}

.variants-table-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
  text-align: center;
}

.variants-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.variants-table th {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 1.5rem;
  text-align: left;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.variants-table td {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  color: #374151;
  font-size: 1rem;
}

.variants-table tr:last-child td {
  border-bottom: none;
}

.variants-table tr:hover {
  background: #f8fafc;
}

/* Product Details Grid */
.product-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.detail-card {
  background: #f8fafc;
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  text-align: center;
  transition: all 0.3s ease;
}

.detail-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15);
}

.detail-label {
  font-weight: 700;
  color: #374151;
  font-size: 1rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  color: #3b82f6;
  font-size: 1.3rem;
  font-weight: 700;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 2rem;
  justify-content: center;
  padding-top: 2.5rem;
  align-items: center;
}

/* MODAL BUTTON - BLUE COLOR WITH FIXED ALIGNMENT */
.modal-quote-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  padding: 1.5rem 3rem;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.2;
  min-height: 56px;
}

.modal-quote-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.4);
}

/* Coming Soon Message */
.coming-soon-message {
  text-align: center;
  padding: 4rem 3rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(16, 185, 129, 0.05));
  border-radius: 24px;
  margin: 2rem;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.coming-soon-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 1.5rem;
}

.coming-soon-text {
  color: #64748b;
  font-size: 1.2rem;
  line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .automation-tabs {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1.5rem 0;
  }
  
  .automation-tab {
    min-height: 160px;
    padding: 2rem;
  }
  
  .automation-tab .tab-icon {
    font-size: 2.4rem;
  }
  
  .automation-tab[data-category="proximity-sensors"] img.tab-icon {
    width: 2.6rem !important;
    height: 2.6rem !important;
  }
  
  .automation-products-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
  }
  
  .product-image-container {
    height: 180px;
  }
}

@media (max-width: 768px) {
  .automation-tabs-container {
    padding: 0 1rem;
  }
  
  .automation-tabs {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }
  
  .automation-tab {
    min-height: 140px;
    padding: 1.5rem;
  }
  
  .automation-tab .tab-icon {
    font-size: 2.2rem;
  }
  
  .automation-tab[data-category="proximity-sensors"] img.tab-icon {
    width: 2.4rem !important;
    height: 2.4rem !important;
  }
  
  .category-title {
    font-size: 2.2rem;
  }
  
  .automation-products-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  .product-image-container {
    height: 160px;
  }
  
  .automation-modal-backdrop {
    padding: 1rem;
  }
  
  .automation-modal-content {
    max-height: calc(100vh - 2rem);
  }
  
  .automation-modal-body {
    padding: 2rem;
  }
  
  .variants-table-container {
    overflow-x: auto;
    padding: 2rem;
  }
  
  .variants-table {
    min-width: 500px;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 1rem;
  }
  
  /* Mobile touch optimization */
  .automation-product-card {
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .automation-product-card * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
}

@media (max-width: 480px) {
  .automation-tabs {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .automation-tab {
    min-height: 120px;
    padding: 1.2rem;
    flex-direction: row;
    gap: 1rem;
  }
  
  .automation-tab .tab-icon {
    font-size: 2rem;
  }
  
  .automation-tab[data-category="proximity-sensors"] img.tab-icon {
    width: 2.2rem !important;
    height: 2.2rem !important;
  }
  
  .category-title {
    font-size: 2rem;
  }
  
  .product-content {
    padding: 1.5rem;
  }
  
  .product-image-container {
    height: 140px;
  }
  
  .automation-modal-backdrop {
    padding: 0.5rem;
  }
  
  .automation-modal-body {
    padding: 1.5rem;
  }
}

/* Animation Classes */
.automation-product-card.animate-in {
  animation: automationCardSlideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes automationCardSlideIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Loading States */
.product-details-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.product-details-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Icon Animations */
@keyframes iconFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(1deg); }
  50% { transform: translateY(-6px) rotate(0deg); }
  75% { transform: translateY(-3px) rotate(-1deg); }
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes iconRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes iconBounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-4px); }
}

.automation-tab.active .tab-icon {
  animation: iconPulse 2s ease-in-out infinite !important;
}

.automation-tab:hover .tab-icon {
  animation: iconBounce 0.6s ease-in-out !important;
}

/* Accessibility */
.automation-tab:focus {
  outline: 3px solid rgba(59, 130, 246, 0.6);
  outline-offset: 4px;
}

.product-details-btn:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .automation-product-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .automation-modal-backdrop {
    display: none;
  }
  
  .automation-tabs {
    display: none;
  }
}

/* Mobile scroll optimization */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    -webkit-overflow-scrolling: touch;
}

/* Ensure cards are properly clickable on mobile */
.automation-product-card {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Prevent scroll issues on mobile */
@media (max-width: 768px) {
    .automation-product-card {
        cursor: pointer;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Modal mobile fixes for text collision with close button */
@media screen and (max-width: 768px) {
  .automation-modal-body {
    padding: 2rem 1.5rem 1.5rem 1.5rem !important;
    padding-top: 3.5rem !important; /* Extra top padding to avoid close button */
  }
  
  .modal-product-title {
    font-size: 1.4rem !important;
    margin-bottom: 1rem !important;
    margin-top: 0 !important;
    padding-right: 60px !important; /* Space for close button */
    line-height: 1.3 !important;
  }
  
  .modal-product-description {
    font-size: 0.95rem !important;
    padding-right: 20px !important; /* Prevent text from going under button */
    margin-bottom: 1.5rem !important;
  }
  
  /* Ensure close button stays visible and accessible */
  .automation-modal-close {
    position: fixed !important; /* Changed from absolute to fixed */
    top: 1rem !important;
    right: 1rem !important;
    z-index: 10003 !important;
    width: 45px !important;
    height: 45px !important;
    font-size: 1.6rem !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    color: #1a202c !important;
  }
  
  .automation-modal-content {
    width: 95% !important;
    margin: 1rem auto !important;
    max-height: 85vh !important;
    border-radius: 16px !important;
  }
  
  /* Prevent text overflow in specs section */
  .product-details-grid {
    padding: 1.5rem 1rem !important;
    margin-bottom: 1.5rem !important;
  }
  
  .detail-card {
    padding: 1.5rem 1rem !important;
  }
  
  .variants-table-container {
    padding: 1.5rem 1rem !important;
    margin-bottom: 1.5rem !important;
  }
  
  .variants-table-title {
    font-size: 1.2rem !important;
    margin-bottom: 1rem !important;
    padding-right: 20px !important;
  }
}

@media screen and (max-width: 480px) {
  .automation-modal-body {
    padding: 4rem 1rem 1rem 1rem !important; /* Even more top padding for small screens */
  }
  
  .modal-product-title {
    font-size: 1.2rem !important;
    padding-right: 50px !important;
  }
  
  .modal-product-description {
    font-size: 0.9rem !important;
  }
  
  .automation-modal-close {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.4rem !important;
  }
}
