/* 
 * DryAlle Design System - Button Components
 * Unified Button System - 8 different styles → 1 consistent system
 * 30-Year CSS Expert Implementation
 */

/* ================================
   BASE BUTTON FOUNDATION
   ================================ */

.btn {
  /* Layout & Positioning */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  
  /* Sizing */
  min-height: var(--button-height-base);
  padding: 0 var(--button-padding-x-base);
  
  /* Typography */
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  text-align: center;
  text-decoration: none;
  line-height: 1;
  letter-spacing: 0.025em;
  
  /* Visual */
  border: 2px solid transparent;
  border-radius: var(--border-radius-button);
  background: transparent;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  
  /* Transitions */
  transition: all var(--transition-base);
  
  /* Touch & Interaction */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  
  /* Performance */
  will-change: transform, box-shadow;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Hover Animation Base */
.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 var(--transition-slow);
  z-index: 1;
}

.btn:hover::before {
  left: 100%;
}

/* Button Content Layer */
.btn > * {
  position: relative;
  z-index: 2;
}

/* ================================
   BUTTON SIZE VARIANTS
   ================================ */

.btn-sm {
  min-height: var(--button-height-sm);
  padding: 0 var(--button-padding-x-sm);
  font-size: var(--font-size-sm);
}

.btn-lg {
  min-height: var(--button-height-lg);
  padding: 0 var(--button-padding-x-lg);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.btn-xl {
  min-height: 3.5rem;
  padding: 0 var(--spacing-10);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

/* ================================
   PRIMARY BUTTON VARIANTS
   ================================ */

.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-white);
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: var(--gradient-primary-reverse);
  color: var(--color-white);
  transform: var(--transform-hover-up);
  box-shadow: var(--shadow-primary-lg);
}

.btn-primary:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-secondary);
  outline-offset: var(--focus-ring-offset);
}

.btn-primary:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-primary);
}

/* ================================
   SECONDARY BUTTON VARIANTS
   ================================ */

.btn-secondary {
  background: var(--color-white);
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-base);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  transform: var(--transform-hover-up);
  box-shadow: var(--shadow-primary);
}

.btn-secondary:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-secondary);
  outline-offset: var(--focus-ring-offset);
}

/* ================================
   ACCENT BUTTON VARIANTS
   ================================ */

.btn-accent {
  background: var(--color-secondary);
  color: var(--color-gray-900);
  border-color: transparent;
  box-shadow: var(--shadow-secondary);
}

.btn-accent:hover {
  background: var(--color-secondary-light);
  color: var(--color-gray-900);
  transform: var(--transform-hover-up);
  box-shadow: 0 12px 30px rgba(246, 236, 61, 0.4);
}

.btn-accent:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
}

/* ================================
   OUTLINE BUTTON VARIANTS
   ================================ */

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  transform: var(--transform-hover-slight);
  box-shadow: var(--shadow-md);
}

.btn-outline-secondary {
  color: var(--color-gray-700);
  border-color: var(--color-gray-300);
}

.btn-outline-secondary:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-900);
  border-color: var(--color-gray-400);
}

/* ================================
   GHOST BUTTON VARIANTS
   ================================ */

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--color-gray-100);
  color: var(--color-primary-dark);
  transform: var(--transform-hover-slight);
}

/* ================================
   LINK BUTTON VARIANTS
   ================================ */

.btn-link {
  background: transparent;
  color: var(--color-primary);
  border: none;
  border-radius: 0;
  padding: var(--spacing-2) var(--spacing-3);
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: auto;
}

.btn-link:hover {
  color: var(--color-primary-dark);
  text-decoration-thickness: 2px;
  transform: none;
  box-shadow: none;
}

/* ================================
   BUTTON STATES
   ================================ */

.btn:disabled,
.btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

.btn.loading {
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 1rem;
  margin: -0.5rem 0 0 -0.5rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 1s linear infinite;
  z-index: 3;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ================================
   BUTTON WITH ICONS
   ================================ */

.btn-icon {
  gap: var(--spacing-2);
}

.btn-icon-only {
  width: var(--button-height-base);
  min-width: var(--button-height-base);
  padding: 0;
}

.btn-icon-only.btn-sm {
  width: var(--button-height-sm);
  min-width: var(--button-height-sm);
}

.btn-icon-only.btn-lg {
  width: var(--button-height-lg);
  min-width: var(--button-height-lg);
}

/* Icon sizing */
.btn .icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.btn-sm .icon {
  width: 0.875em;
  height: 0.875em;
}

.btn-lg .icon {
  width: 1.125em;
  height: 1.125em;
}

/* ================================
   BUTTON GROUPS
   ================================ */

.btn-group {
  display: inline-flex;
  gap: 1px;
  border-radius: var(--border-radius-button);
  overflow: hidden;
  box-shadow: var(--shadow-base);
}

.btn-group .btn {
  border-radius: 0;
  margin: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-group .btn:last-child {
  border-right: none;
}

.btn-group .btn:hover {
  z-index: 1;
  position: relative;
}

/* ================================
   SPECIAL PURPOSE BUTTONS
   ================================ */

/* CTA (Call to Action) Buttons */
.btn-cta {
  background: var(--gradient-primary);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-primary);
  border: none;
}

.btn-cta:hover {
  transform: var(--transform-hover-up);
  box-shadow: var(--shadow-primary-lg);
  background: var(--gradient-primary-reverse);
  color: var(--color-white);
}

/* Phone/Contact Buttons */
.btn-phone {
  background: var(--gradient-hero);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  box-shadow: var(--shadow-primary);
}

.btn-phone:hover {
  background: var(--gradient-primary-reverse);
  color: var(--color-white);
  transform: var(--transform-hover-up);
  box-shadow: var(--shadow-primary-lg);
}

/* WhatsApp Button */
.btn-whatsapp {
  background: #25D366;
  color: var(--color-white);
  border-color: #25D366;
}

.btn-whatsapp:hover {
  background: #128C7E;
  color: var(--color-white);
  border-color: #128C7E;
  transform: var(--transform-hover-up);
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
}

/* ================================
   RESPONSIVE DESIGN - CTA & GENERAL BUTTONS
   ================================ */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  .cta-buttons {
    gap: var(--spacing-6);
    justify-content: center !important;
  }
  
  .cta-button.large {
    min-width: 320px;
    max-width: 450px;
    font-size: var(--font-size-lg);
    flex: 1 1 auto;
    white-space: nowrap;
  }
}

/* Desktop (1024px - 1199px) */
@media (max-width: 1199px) and (min-width: 1024px) {
  .cta-buttons {
    justify-content: center !important;
  }
  
  .cta-button.large {
    min-width: 300px;
    max-width: 420px;
    font-size: var(--font-size-base);
    flex: 1 1 auto;
    white-space: nowrap;
  }
}

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
  .cta-buttons {
    justify-content: center !important;
    gap: var(--spacing-4);
    flex-wrap: nowrap;
  }
  
  .cta-button {
    min-width: 200px;
    flex: 1 1 auto;
    max-width: 300px;
  }
  
  .cta-button.large {
    min-height: 52px;
    min-width: 260px;
    max-width: 380px;
    padding: 0 var(--spacing-5);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    flex: 1 1 auto;
  }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
  .btn {
    min-height: 44px; /* iOS touch target minimum */
    font-size: var(--font-size-base);
  }
  
  .btn-lg {
    min-height: 48px;
    font-size: var(--font-size-lg);
  }
  
  /* CTA Buttons Mobile Optimization */
  .cta-buttons {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-4);
    width: 100%;
    margin: var(--spacing-6) auto;
  }
  
  .cta-button {
    width: 90%;
    min-width: auto;
    max-width: 350px;
    justify-content: center;
    flex-shrink: 0;
  }
  
  .cta-button.large {
    min-height: auto;
    min-width: auto;
    max-width: 350px;
    font-size: var(--font-size-sm);
    padding: var(--spacing-4) var(--spacing-5);
    white-space: normal;
    line-height: 1.3;
    text-align: center;
  }
  
  /* Full width buttons on mobile */
  .btn-mobile-full {
    width: 100%;
    justify-content: center;
  }
  
  /* Stack button groups vertically on mobile */
  .btn-group-mobile-stack {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group-mobile-stack .btn {
    border-radius: var(--border-radius-button);
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1px;
  }
  
  .btn-group-mobile-stack .btn:last-child {
    border-bottom: none;
    margin-bottom: 0;
  }
}

/* Small Mobile (< 480px) */
@media (max-width: 479px) {
  .cta-buttons {
    padding: 0 var(--spacing-4);
  }
  
  .cta-button {
    font-size: var(--font-size-sm);
    padding: 0 var(--spacing-4);
    width: 100%;
    max-width: 300px;
  }
  
  .cta-button.large {
    min-height: auto;
    font-size: var(--font-size-xs);
    padding: var(--spacing-3) var(--spacing-4);
    white-space: normal;
    line-height: 1.4;
    text-align: center;
  }
}

/* ================================
   ACCESSIBILITY ENHANCEMENTS
   ================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn,
  .cta-button {
    border-width: 3px;
    border-style: solid;
  }
  
  .btn-primary,
  .cta-button.primary {
    border-color: var(--color-white);
  }
  
  .btn-secondary,
  .btn-outline,
  .cta-button.secondary {
    border-color: var(--color-primary);
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn::before,
  .cta-button,
  .cta-button::before {
    transition: none;
  }
  
  .btn:hover,
  .cta-button:hover {
    transform: none;
  }
  
  .btn.loading::after {
    animation: none;
  }
}

/* ================================
   LEGACY BUTTON CLASSES MAPPING
   ================================ */

/* ================================
   REGION PAGES CTA SYSTEM - MIT LEVEL
   Dedicated CTA buttons for 36 region pages
   ================================ */

/* Base CTA Button for Region Pages */
.cta-button {
  /* Inherit base button foundation */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  
  /* Typography - Enhanced for CTA impact */
  font-family: var(--font-family-primary);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  line-height: 1;
  letter-spacing: 0.03em;
  
  /* Layout - Optimized for region pages */
  min-height: 48px;
  padding: 0 var(--spacing-8);
  min-width: 200px;
  
  /* Visual - Corporate square design */
  border: 2px solid transparent;
  border-radius: 2px; /* Slightly rounded for elegance */
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  
  /* Transitions - Premium smooth experience */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Performance optimization */
  will-change: transform, box-shadow;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* CTA Hover Animation Base */
.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.25) 50%, 
    transparent 100%
  );
  transition: left 0.5s ease;
  z-index: 1;
}

.cta-button:hover::before {
  left: 100%;
}

/* Content Layer */
.cta-button > * {
  position: relative;
  z-index: 2;
}

/* ================================
   CTA BUTTON VARIANTS FOR REGIONS
   ================================ */

/* Primary CTA - Phone Buttons */
.cta-button.primary {
  background: linear-gradient(135deg, 
    var(--color-primary-darker) 0%, 
    #1a5d42 100%
  );
  color: var(--color-white);
  border-color: var(--color-primary-darker);
  box-shadow: 
    0 8px 20px rgba(0, 98, 59, 0.25),
    0 3px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.cta-button.primary:hover {
  background: linear-gradient(135deg, 
    var(--color-primary) 0%, 
    var(--color-primary-darker) 100%
  );
  color: var(--color-white);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 
    0 15px 35px rgba(0, 98, 59, 0.35),
    0 5px 15px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.cta-button.primary:active {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 
    0 8px 20px rgba(0, 98, 59, 0.25),
    0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Secondary CTA - WhatsApp & Contact Buttons */
.cta-button.secondary {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(248, 249, 250, 0.9) 100%
  );
  color: var(--color-primary-darker);
  border-color: var(--color-primary-darker);
  box-shadow: 
    0 6px 16px rgba(0, 98, 59, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.cta-button.secondary:hover {
  background: linear-gradient(135deg, 
    var(--color-primary-darker) 0%, 
    #1a5d42 100%
  );
  color: var(--color-white);
  border-color: var(--color-primary-darker);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 
    0 12px 30px rgba(0, 98, 59, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.cta-button.secondary:active {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 
    0 6px 16px rgba(0, 98, 59, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Large Size Variant for Region Pages */
.cta-button.large {
  min-height: 56px;
  padding: 0 var(--spacing-8);
  font-size: var(--font-size-base);
  font-weight: 700;
  min-width: 280px;
  max-width: 400px;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================
   CTA BUTTONS CONTAINER
   ================================ */

.cta-buttons {
  display: flex !important;
  gap: var(--spacing-5);
  flex-wrap: wrap;
  align-items: center !important;
  justify-content: center !important;
  margin: var(--spacing-6) auto !important;
  width: 100% !important;
  text-align: center;
}

/* ================================
   LONG TEXT OPTIMIZATION
   ================================ */

/* For very long region names */
.cta-button.primary.large {
  word-break: keep-all;
  hyphens: none;
}

/* Responsive text size based on content length */
.cta-button.primary.large[href*="Fenerbahçe"],
.cta-button.primary.large[href*="Caddebostan"],
.cta-button.primary.large[href*="Küçükbakkalköy"] {
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  padding: var(--spacing-4) var(--spacing-6);
}

@media (max-width: 1200px) {
  .cta-button.primary.large[href*="Fenerbahçe"],
  .cta-button.primary.large[href*="Caddebostan"],
  .cta-button.primary.large[href*="Küçükbakkalköy"] {
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
  }
}

@media (max-width: 768px) {
  .cta-button.primary.large[href*="Fenerbahçe"],
  .cta-button.primary.large[href*="Caddebostan"],
  .cta-button.primary.large[href*="Küçükbakkalköy"] {
    white-space: normal;
    line-height: 1.3;
    font-size: var(--font-size-xs);
  }
}

/* ================================
   FOCUS & ACCESSIBILITY
   ================================ */

.cta-button:focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 3px;
  box-shadow: 
    0 8px 20px rgba(0, 98, 59, 0.25),
    0 3px 8px rgba(0, 0, 0, 0.1),
    0 0 0 3px var(--color-secondary);
}

/* ================================
   LEGACY SYSTEM MAPPING (Working CSS)
   ================================ */

/* These map old classes to new system - REAL CSS not Sass */
.search-btn { 
  @apply btn btn-accent btn-icon-only; 
}
.locate-btn { 
  @apply btn btn-primary btn-icon-only; 
}
.learn-more-btn { 
  @apply btn btn-link; 
}
.service-link { 
  @apply btn btn-link; 
}
.article-link { 
  @apply btn btn-link; 
}
.category-link { 
  @apply btn btn-outline; 
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

/* GPU acceleration for smoother animations */
.btn,
.cta-button {
  transform: translate3d(0, 0, 0);
}

/* Optimize for paint performance */
.btn:hover,
.btn:focus,
.cta-button:hover,
.cta-button:focus {
  will-change: transform, box-shadow;
}

.btn:not(:hover):not(:focus),
.cta-button:not(:hover):not(:focus) {
  will-change: auto;
}

/* ================================
   PRINT STYLES FOR CTA BUTTONS
   ================================ */

@media print {
  .cta-button {
    background: none !important;
    color: var(--color-text) !important;
    border: 2px solid var(--color-text) !important;
    box-shadow: none !important;
    transform: none !important;
  }
  
  .cta-button::before {
    display: none;
  }
  
  .cta-buttons {
    flex-direction: column;
    gap: var(--spacing-2);
  }
}