/* ============================================
   GLYCON COMPATIBILITY & FIXES
   Ensures new design works with existing styles
   ============================================ */

/* Reset conflicting styles from old theme */
.g-page {
  font-family: var(--g-font-family);
  color: var(--g-text-primary);
  background: var(--g-bg-primary);
  overflow: visible !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
}

.g-page a {
  text-decoration: none;
  transition: all var(--g-transition-fast);
}

.g-page a:hover {
  text-decoration: none;
}

/* Fix nested scroll issue on homepage */
body#home {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh;
}

body#home .g-page {
  overflow: visible !important;
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Remove scroll from all sections */
body#home section,
body#home .g-hero,
body#home .g-container {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Ensure buttons don't inherit old styles */
.g-btn {
  font-family: var(--g-font-family) !important;
  text-decoration: none !important;
  box-sizing: border-box;
}

.g-btn:hover,
.g-btn:focus,
.g-btn:active {
  text-decoration: none !important;
  outline: none;
}

/* Fix form inputs */
.g-form-input,
.g-form-select,
.g-form-textarea {
  font-family: var(--g-font-family) !important;
  box-sizing: border-box;
}

.g-form-input:focus,
.g-form-select:focus,
.g-form-textarea:focus {
  outline: none;
}

/* Card fixes */
.g-card,
.g-product-card,
.g-software-card {
  box-sizing: border-box;
}

/* Ensure images are responsive */
.g-page img {
  max-width: 100%;
  height: auto;
}

/* Fix oversized images in content areas */
.g-page img:not(.g-hero-mockup):not(.g-testimonial-avatar):not(.g-software-card-image img):not(.g-sw-product-image img) {
  max-height: 600px;
  object-fit: contain;
}

/* Specific fixes for product/software pages */
.g-software-detail img,
.g-software-content img,
.g-card-body img {
  max-width: 100% !important;
  height: auto !important;
  max-height: 500px;
  object-fit: contain;
}

/* Software list page images */
.g-sw-product-image {
  background: #f8fafc !important;
  height: 280px !important;
}
.g-sw-product-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center top !important;
  max-height: none !important;
  border-radius: 0 !important;
  filter: none !important;
}

/* Fix z-index issues */
.g-header {
  position: relative;
  z-index: var(--g-z-sticky);
}

.g-header-main {
  position: sticky;
  top: 0;
  z-index: var(--g-z-sticky);
}

.g-mobile-menu {
  z-index: 99999 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

.g-mobile-menu-overlay {
  z-index: 99998 !important;
}

/* Fix footer positioning */
.g-footer {
  position: relative;
  z-index: 1;
}

/* ============================================
   ADDITIONAL RESPONSIVE FIXES
   ============================================ */

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
}

html {
  overflow-y: auto;
  height: auto;
}

body {
  overflow-y: auto;
  height: auto;
  min-height: 100vh;
}

.g-page {
  overflow: visible;
  height: auto;
}

/* Mobile navigation spacing */
@media (max-width: 1024px) {
  body {
    padding-bottom: 70px;
  }
  
  .g-footer {
    margin-bottom: 70px;
  }
}

/* Fix hero on smaller screens */
@media (max-width: 768px) {
  .g-hero {
    padding: var(--g-space-10) 0 var(--g-space-8);
  }
  
  .g-hero-title {
    font-size: var(--g-font-size-3xl);
    line-height: 1.2;
  }
  
  .g-hero-desc {
    font-size: var(--g-font-size-base);
  }
  
  .g-hero-badge {
    font-size: var(--g-font-size-xs);
    padding: var(--g-space-1) var(--g-space-3);
  }
  
  .g-hero-price {
    flex-direction: column;
    align-items: center;
    gap: var(--g-space-2);
  }
  
  .g-hero-nav {
    display: none;
  }
}

/* Fix software cards on mobile */
@media (max-width: 768px) {
  .g-software-card-content {
    padding: var(--g-space-5);
  }
  
  .g-software-card-features {
    grid-template-columns: 1fr;
  }
  
  .g-software-card-footer {
    flex-direction: column;
    gap: var(--g-space-4);
  }
  
  .g-software-card-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .g-software-card-actions .g-btn {
    width: 100%;
  }
}

/* Fix package cards on mobile */
@media (max-width: 768px) {
  .g-packages-grid {
    grid-template-columns: 1fr;
    gap: var(--g-space-4);
  }
  
  .g-package-card {
    margin-bottom: var(--g-space-4);
  }
}

/* Fix testimonials on mobile */
@media (max-width: 768px) {
  .g-testimonials-grid {
    grid-template-columns: 1fr;
    gap: var(--g-space-4);
  }
  
  .g-testimonial-card {
    padding: var(--g-space-5);
  }
}

/* Fix trust section on mobile */
@media (max-width: 768px) {
  .g-trust-grid {
    grid-template-columns: 1fr;
    gap: var(--g-space-3);
  }
  
  .g-trust-item {
    padding: var(--g-space-4);
  }
}

/* Fix contact page on mobile */
@media (max-width: 768px) {
  .g-contact-grid {
    grid-template-columns: 1fr;
    gap: var(--g-space-6);
  }
  
  .g-contact-form-card {
    padding: var(--g-space-5);
  }
}

/* Fix software detail on mobile */
@media (max-width: 768px) {
  .g-software-detail-grid {
    grid-template-columns: 1fr;
    gap: var(--g-space-6);
  }
  
  .g-software-detail-sidebar {
    position: static;
  }
}

/* ============================================
   ANIMATION PERFORMANCE
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .g-header,
  .g-footer,
  .g-mobile-menu,
  .g-mobile-menu-overlay,
  .mobile-bottom-nav {
    display: none !important;
  }
  
  .g-page {
    background: white;
  }
  
  .g-btn {
    border: 1px solid #000;
    background: white !important;
    color: #000 !important;
  }
}

/* ============================================
   LEGACY COMPATIBILITY
   ============================================ */

/* Ensure old Bootstrap grid still works */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
.col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
  position: relative;
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
}

@media (min-width: 768px) {
  .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-md-9 { flex: 0 0 75%; max-width: 75%; }
  .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Clear fix */
.clear {
  clear: both;
}

/* Container compatibility */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Text alignment utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ============================================
   FIX NESTED SCROLL ON HOMEPAGE
   ============================================ */

/* Remove any fixed height/scroll from old theme elements */
body#home,
body#home html {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh;
}

/* Hide the old loading overlay properly */
body#home #wisecp {
  display: none !important;
  position: absolute !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Ensure main content doesn't create nested scroll */
body#home .g-page,
body#home .g-header,
body#home .g-footer,
body#home section {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Fix any container that might have scroll */
body#home .g-container {
  overflow: visible !important;
  height: auto !important;
}

/* Override old slider/hero scroll issues */
body#home section.home-slider,
body#home .slider-items,
body#home .owl-carousel,
body#home .owl-stage-outer {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Ensure sections don't have individual scrollbars */
body#home .g-hero,
body#home .g-software-section,
body#home .g-features-section,
body#home .g-services-section,
body#home .g-testimonials-section,
body#home .g-trust-section,
body#home .g-support-cta {
  overflow: visible !important;
  height: auto !important;
}

/* ============================================
   FIX OVERSIZED IMAGES ON ALL PAGES
   ============================================ */

/* General image size limits */
img {
  max-width: 100%;
  height: auto;
}

/* Product/Software detail page images */
.product-image img,
.software-image img,
.detail-image img,
.mockup-image img,
.gallery-image img {
  max-width: 100% !important;
  max-height: 500px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

/* Content area images */
.content img,
.description img,
.page-content img,
article img,
.entry-content img {
  max-width: 100% !important;
  max-height: 600px !important;
  height: auto !important;
  object-fit: contain !important;
}

/* Card images */
.card img,
.product-card img,
.item-card img {
  max-width: 100% !important;
  height: auto !important;
  object-fit: cover;
}

/* Fix old theme specific image containers */
.slider-image img,
.banner-image img,
.hero-image img {
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
}

/* ============================================
   CRITICAL: FORCE REMOVE NESTED SCROLL
   ============================================ */

/* Hide old theme page headers */
.sayfaustheader,
.sayfabaslik,
#header2 .sayfabaslik,
.headerwhite {
  display: none !important;
}

/* Fix old theme content inside new design */
.g-software-content .row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -15px;
  justify-content: center;
}

.g-software-content .col-md-3,
.g-software-content .col-md-4,
.g-software-content .col-md-6 {
  padding: 15px;
  text-align: center;
}

.g-software-content .col-md-3 {
  flex: 0 0 25%;
  max-width: 25%;
}

.g-software-content .col-md-4 {
  flex: 0 0 33.333%;
  max-width: 33.333%;
}

.g-software-content .col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
}

@media (max-width: 768px) {
  .g-software-content .col-md-3,
  .g-software-content .col-md-4,
  .g-software-content .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Fix old theme feature boxes */
.g-software-content img {
  max-width: 80px !important;
  height: auto !important;
  margin-bottom: 15px;
}

.g-software-content h4,
.g-software-content h5 {
  font-size: var(--g-font-size-lg);
  font-weight: var(--g-font-weight-bold);
  color: var(--g-text-primary);
  margin-bottom: var(--g-space-3);
}

.g-software-content p {
  font-size: var(--g-font-size-sm);
  color: var(--g-text-secondary);
  line-height: 1.6;
}

/* CRITICAL: Fix software detail page layout */
.g-software-detail-grid {
  display: grid !important;
  grid-template-columns: 1fr 380px !important;
  gap: 40px !important;
  align-items: start !important;
}

.g-software-detail-gallery {
  max-width: 100% !important;
  overflow: hidden !important;
  min-height: auto !important;
}

.g-software-detail-main-image {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 450px !important;
  object-fit: contain !important;
  display: block !important;
  background: #f8fafc !important;
  border-radius: 16px !important;
}

.g-software-detail-sidebar {
  position: sticky !important;
  top: 100px !important;
  max-width: 380px !important;
}

.g-software-content img {
  max-width: 100% !important;
  height: auto !important;
  max-height: 500px !important;
  object-fit: contain !important;
}

@media (max-width: 1024px) {
  .g-software-detail-grid {
    display: block !important;
  }
  .g-software-detail-sidebar {
    position: relative !important;
    top: 0 !important;
    max-width: 100% !important;
    margin-top: 24px !important;
  }
}

/* CRITICAL: Fix packages grid - centered */
.g-packages-section .g-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

.g-packages-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 24px !important;
  width: 100% !important;
  max-width: 1000px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.g-packages-grid > .g-package-card {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Center filter tabs */
.g-sw-filter-tabs {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
  margin-bottom: 32px !important;
}

@media (max-width: 1024px) {
  .g-packages-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 700px !important;
  }
}

@media (max-width: 640px) {
  .g-packages-grid {
    grid-template-columns: 1fr !important;
    max-width: 400px !important;
  }
}

/* Force remove scroll from .g-page on all pages */
.g-page {
  overflow: visible !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
  min-height: auto !important;
  position: relative !important;
}

/* Force body scroll behavior */
html {
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  height: auto !important;
}

body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh !important;
}

body#home {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
}

/* Remove any scroll from sections */
.g-page > section,
.g-page .g-hero,
.g-page .g-software-section,
.g-page .g-features-section,
.g-page .g-services-section,
.g-page .g-testimonials-section,
.g-page .g-trust-section,
.g-page .g-support-cta {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Remove scroll from containers */
.g-page .g-container {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}
