/**
 * HomeFix Essential Custom Styles
 * Only styles that cannot be replaced with Tailwind utilities
 *
 * @package HomeFix_Pro
 * @since 1.0.0
 */

/* =============================================================================
   HEADER STYLES
   Header height and container size customization
   ============================================================================= */

/* Header Height CSS Variable */
nav {
  --header-height: 80px;
}

/* Container Size Variations */
nav .w-full {
  width: 100%;
}

nav .container {
  max-width: 1280px;
}

/* =============================================================================
   LOGO STYLES
   Responsive logo sizing to prevent header overflow
   ============================================================================= */
/* Custom Logo - Constrain size and make responsive */
.custom-logo-link {
  display: inline-block;
  line-height: 0;
}

.custom-logo {
  max-height: calc(var(--header-height, 80px) * 0.7);
  width: auto;
  height: auto;
  object-fit: contain;
  transition: max-height 0.3s ease;
}

/* Responsive logo sizing */
@media (max-width: 768px) {
  .custom-logo {
    max-height: calc(var(--header-height, 80px) * 0.6);
  }
}

@media (max-width: 480px) {
  .custom-logo {
    max-height: calc(var(--header-height, 80px) * 0.5);
  }
}

/* =============================================================================
   NAVIGATION & MENU STYLES
   Essential dropdown and mobile menu functionality
   ============================================================================= */

/* Mobile Menu Toggle Animation */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.mobile-menu.open {
  max-height: 500px;
  transition: max-height 0.3s ease-in;
}

/* Dropdown Menu Core Functionality */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  width: 12rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  z-index: 50;
}

/* Show dropdown on hover OR focus (accessibility) */
.group:hover .dropdown-menu,
.group:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
}

/* Keyboard navigation support */
.dropdown-menu.opacity-100 {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Nested Submenu Positioning */
.dropdown-submenu {
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: 0.5rem;
  width: 12rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  z-index: 51;
}

.dropdown-menu li:hover .dropdown-submenu,
.dropdown-menu li.group:hover .dropdown-submenu {
  opacity: 1;
  visibility: visible;
}

/* Menu Button Reset (for accessibility buttons) */
.submenu {
  background: none;
  border: none;
  padding: 0;
  text-align: inherit;
}

/* Mobile Submenu Indentation */
.mobile-submenu {
  padding-left: 1rem;
  border-left: 2px solid #e5e7eb;
  margin-left: 1rem;
  margin-top: 0.5rem;
}

.mobile-submenu.show {
  display: block !important;
}

/* =============================================================================
   FOCUS STYLES FOR ACCESSIBILITY
   Essential for keyboard navigation
   ============================================================================= */

.nav-link:focus,
.submenu:focus {
  outline: 2px solid var(--homefix-primary-color, #2563eb);
  outline-offset: 2px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 0.25rem;
}

.dropdown-menu .nav-link:focus,
.dropdown-menu .submenu:focus {
  background: var(--homefix-light-color);
  outline: 2px solid var(--homefix-primary-color, #2563eb);
  outline-offset: -2px;
}

.service-card:focus-within {
  outline: 2px solid var(--homefix-primary-color, #2563eb);
  outline-offset: 2px;
}

.service-card a:focus {
  outline: 2px solid var(--homefix-primary-color, #2563eb);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =============================================================================
   COMPONENT-SPECIFIC STYLES
   Styles that integrate with CSS variables but can't be done with Tailwind
   ============================================================================= */

/* Service Button with CSS Variables */
.service-btn {
  background: var(--homefix-primary-color, #2563eb);
  color: white;
  border: 2px solid var(--homefix-primary-color, #2563eb);
  transition: all 0.3s ease;
}

.service-btn:hover {
  background: transparent;
  color: var(--homefix-primary-color, #2563eb);
}

/* Link Color Integration */
.service-card .link-color {
  color: var(--homefix-link-color, #2563eb);
  transition: color 0.3s ease;
}

.service-card .link-color:hover {
  color: var(--homefix-link-hover-color, #1d4ed8);
}

/* =============================================================================
   GLOBAL BACKGROUND SYSTEM
   Essential for customizer background functionality
   ============================================================================= */

/* Background System - Only applied to nav, sections are controlled manually in homefix-colors.css */
nav:not(#pagination-nav) {
  /* Background will be set via unified customizer CSS variable */
  /* Either solid color or gradient based on user selection */
  background: var(--homefix-background, #ffffff);
  transition: background 0.3s ease;
}

/* Override for specific sections that need different backgrounds */
.section-override {
  /* Use this class to override the global background for specific sections */
  background: none !important;
}

/* =============================================================================
   PRINT STYLES
   Essential for proper printing
   ============================================================================= */

@media print {
  .service-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }

  .dropdown-menu,
  .dropdown-submenu,
  .mobile-menu {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: none !important;
  }

  /* Hide interactive elements in print */
  .swiper-button-next,
  .swiper-button-prev,
  .swiper-pagination,
  .video-controls {
    display: none !important;
  }
}

/* =============================================================================
   UTILITY CLASSES THAT EXTEND TAILWIND
   Custom utilities that work with the design system
   ============================================================================= */

/* Ensure proper positioning for nested menus */
.dropdown-menu li,
.dropdown-submenu li {
  position: relative;
}

/* =============================================================================
   ANIMATION KEYFRAMES
   Essential animations that can't be replaced with Tailwind
   ============================================================================= */

/* Fade in animation for hero slider */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Prevent animations from running before page is fully loaded */
.animate-fade-in {
  opacity: 0;
  transform: translateY(30px);
}

/* Apply animation to active slides - Only when page is loaded */
body.page-loaded .swiper-slide-active .animate-fade-in {
  animation: fadeInUp 1s ease-out forwards;
}

body.page-loaded .swiper-slide-active .animate-fade-in.delay-100 {
  animation-delay: 0.2s;
}

body.page-loaded .swiper-slide-active .animate-fade-in.delay-200 {
  animation-delay: 0.4s;
}

body.page-loaded .swiper-slide-active .animate-fade-in.delay-300 {
  animation-delay: 0.6s;
}

/* =============================================================================
   COMPONENT STATES
   States that require specific CSS that Tailwind can't handle
   ============================================================================= */

/* Submenu hover state with CSS variables */
.submenu:hover {
  color: var(--homefix-primary-color, #2563eb);
}

/* Loading states for dynamic content */
.homefix-hero-swiper.swiper-loading {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.homefix-hero-swiper.swiper-loaded {
  opacity: 1;
}

/* ===========================
Pages
=========================== */
/* Services Page */
.price-badge {
  position: absolute;
  top: -15px;
  right: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   BOOKING PAGE COMPONENT STYLES
   Selection states for booking form elements
   ============================================================================= */

/* Service option selection state */
.service-option {
  border: 2px solid var(--homefix-dark-color, #e5e7eb);
  transition: all 0.2s ease;
}

.service-option:hover {
  border-color: var(--homefix-primary-color, #2563eb);
}

.service-option.selected {
  border-color: var(--homefix-primary-color, #2563eb);
  background: var(--homefix-primary-light, rgba(59, 130, 246, 0.1));
}

/* Time type button selection state */
.time-type-btn {
  border: 1px solid var(--homefix-dark-color, #e5e7eb);
  background: var(--homefix-base-color, #ffffff);
  color: var(--homefix-text-color, #1f2937);
  transition: all 0.2s ease;
}

.time-type-btn:hover {
  border-color: var(--homefix-primary-color, #2563eb);
}

.time-type-btn.selected {
  background: var(--homefix-primary-color, #2563eb);
  color: var(--homefix-base-color, #ffffff);
  border-color: var(--homefix-primary-color, #2563eb);
}

/* Time slot selection state */
.time-slot {
  border: 1px solid var(--homefix-dark-color, #e5e7eb);
  transition: all 0.2s ease;
}

.time-slot:hover {
  border-color: var(--homefix-primary-color, #2563eb);
  background: var(--homefix-primary-light, rgba(59, 130, 246, 0.05));
}

.time-slot.selected {
  border-color: var(--homefix-primary-color, #2563eb);
  background: var(--homefix-primary-light, rgba(59, 130, 246, 0.1));
}

/* Selection border class - used for form elements */
.selection-border {
  border: 2px solid var(--homefix-dark-color, #e5e7eb);
}

/* Step indicator styles */
.step-indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  background: var(--homefix-light-color, #f3f4f6);
  color: var(--homefix-text-color, #6b7280);
  transition: all 0.3s ease;
}

.step-indicator.active {
  background: var(--homefix-primary-color, #2563eb);
  color: var(--homefix-base-color, #ffffff);
}

.step-indicator.completed {
  background: #16a34a;
  color: var(--homefix-base-color, #ffffff);
}

.step-indicator.completed::after {
  content: '✓';
}

/* Step label styles */
.step-label-inactive {
  color: var(--homefix-text-light, #6b7280);
}

.step-label-active {
  color: var(--homefix-text-color, #1f2937);
  font-weight: 600;
}

/* Progress bar background */
.progress-bg {
  background: #e5e7eb;
}

/* =============================================================================
   PAGINATION STYLES
   Styles for pagination buttons in technician/blog pages
   ============================================================================= */

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  color: var(--homefix-text-color, #6b7280);
  background: var(--homefix-base-color, #ffffff);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  margin: 0 2px;
}

.pagination-btn:hover:not(.active):not(:disabled) {
  background: var(--homefix-light-color, #f3f4f6);
  border-color: var(--homefix-primary-color, #2563eb);
  color: var(--homefix-primary-color, #2563eb);
}

.pagination-btn.active {
  background: var(--homefix-primary-color, #2563eb);
  color: var(--homefix-base-color, #ffffff);
  border-color: var(--homefix-primary-color, #2563eb);
  font-weight: 600;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===========================
   Customizer Partials Related
   =========================== */

.homefix-desk-menu .customize-partial-edit-shortcut {
  left: 50%;
}

.hero-section .customize-partial-edit-shortcut {
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.homefix-services .customize-partial-edit-shortcut,
.homefix-technicians .customize-partial-edit-shortcut,
.homefix-whyus .customize-partial-edit-shortcut,
.homefix-testimonials .customize-partial-edit-shortcut,
.homefix-cta .customize-partial-edit-shortcut,
.homefix-blog-section .customize-partial-edit-shortcut {
  position: relative;
  top: 25%;
  left: 35%;
  transform: translate(-50%, -50%);
}