/**
 * Base CSS - Fiorra Touch Performance
 * SADECE touch optimizasyonları - mevcut stilleri değiştirmez
 * 
 * Son Güncelleme: 29.12.2024 10:30:00
 * Güncelleme Konusu: iOS Uyumu
 */

/* ============================================
   iOS PWA - TEMEL UYUM STİLLERİ
   ============================================ */

html, body {
    -webkit-text-size-adjust: 100%;
    background-color: #1e1e2e; /* iOS Status Bar arka planı */
}

body {
    /* iOS Safe Area - Üst (Status Bar) */
    padding-top: env(safe-area-inset-top);
    /* iOS Safe Area - Alt (Home Indicator) */
    padding-bottom: env(safe-area-inset-bottom);
}

/* iOS 100vh Bug Fix */
.full-height,
.modal,
.overlay,
.menu-overlay,
.loading-overlay {
    min-height: 100svh;
    min-height: -webkit-fill-available;
}

/* Hover sadece mouse destekleyen cihazlarda */
@media (hover: hover) {
    button:hover,
    a:hover,
    .btn:hover,
    .menu-item:hover,
    .card:hover {
        opacity: 0.9;
    }
}

/* ============================================
   TOUCH PERFORMANCE (iOS 300ms delay fix)
   ============================================ */

html {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

* {
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   BUTTONS - Touch Optimized
   ============================================ */

button, 
.btn,
.btn-primary,
.btn-secondary,
[role="button"],
input[type="submit"],
input[type="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    /* Minimum touch target - Apple/Google önerisi */
    min-height: 44px;
    min-width: 44px;
    /* Anında tepki için */
    transition: transform 0.1s ease, opacity 0.1s ease, background-color 0.1s ease !important;
}

/* Instant visual feedback on touch */
button:active:not(:disabled),
.btn:active:not(:disabled),
.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled),
[role="button"]:active,
input[type="submit"]:active:not(:disabled),
input[type="button"]:active:not(:disabled) {
    transform: scale(0.95) !important;
    opacity: 0.85 !important;
    transition: transform 0.05s ease, opacity 0.05s ease !important;
}

/* ============================================
   LINKS - Touch Optimized
   ============================================ */

a {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

a:active {
    opacity: 0.7;
    transition: opacity 0.05s ease;
}

/* ============================================
   INTERACTIVE ELEMENTS - Genişletilmiş
   ============================================ */

.menu-item,
.card,
.list-item,
.clickable,
.persona-card,
.offer-card,
.reward-card,
.notification-item,
.transaction-item,
.package-card,
.feature-item,
.option-item,
.setting-item,
[onclick],
[data-action],
label[for],
select,
.nav-item,
.tab-item,
.back-btn,
.back-button,
.close-btn,
.icon-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
}

/* Active states for interactive elements */
.menu-item:active,
.card:active,
.list-item:active,
.clickable:active,
.persona-card:active,
.offer-card:active,
.reward-card:active,
.notification-item:active,
.transaction-item:active,
.package-card:active,
.feature-item:active,
.option-item:active,
.setting-item:active,
[onclick]:active,
[data-action]:active,
.nav-item:active,
.tab-item:active,
.back-btn:active,
.back-button:active,
.close-btn:active,
.icon-btn:active {
    transform: scale(0.97);
    opacity: 0.85;
    transition: transform 0.05s ease, opacity 0.05s ease;
}

/* ============================================
   MINIMUM TOUCH TARGETS
   ============================================ */

.back-btn,
.back-button,
.close-btn,
.icon-btn,
.nav-item,
.tab-item {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   INPUTS - iOS Zoom Prevention
   ============================================ */

/* Prevent zoom on input focus (iOS) - minimum 16px */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="url"],
textarea,
select {
    font-size: max(16px, 1em);
    touch-action: manipulation;
}

/* ============================================
   DISABLE TEXT SELECTION ON INTERACTIVE
   ============================================ */

button,
.btn,
.menu-item,
.card,
.nav-item,
.tab-item,
[role="button"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ============================================
   FAST TOUCH CLASS (JavaScript ile kullanılır)
   ============================================ */

.touch-active {
    transform: scale(0.95) !important;
    opacity: 0.8 !important;
}

/* ============================================
   PERFORMANCE UTILITIES
   ============================================ */

/* GPU acceleration for animations */
.gpu-accelerated {
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Smooth scrolling with momentum */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Prevent pull-to-refresh on some elements */
.no-pull-refresh {
    overscroll-behavior-y: contain;
}

/* Loading skeleton animation */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ============================================
   PRELOADER / LOADING STATE
   iOS Safari Compatible
   ============================================ */

.loading-state {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    z-index: 9999;
    /* iOS PWA safe area */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    /* Hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.loading-spinner {
    margin: 0 auto;
    width: 80px;
    height: 80px;
    position: relative;
    /* Hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff6b9d;
    border-radius: 50%;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    /* Hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.spinner-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: #9d4edd;
    -webkit-animation-duration: 1.5s;
    animation-duration: 1.5s;
}

.spinner-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top-color: #ffd700;
    -webkit-animation-duration: 2s;
    animation-duration: 2s;
}

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

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

.loading-text {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    -webkit-animation: pulse 1.5s ease-in-out infinite;
    animation: pulse 1.5s ease-in-out infinite;
}

@-webkit-keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
