/**
 * Mobile-First Responsive CSS
 * OyunAlışveriş - Mobil Öncelikli Tasarım
 */

/* =====================================================
   CSS VARIABLES (Fallbacks)
   ===================================================== */
:root {
    --white-color: #ffffff;
    --border-color: #e2e8f0;
    --radius-md: 1rem;
    --radius-sm: 0.6rem;
    --shadow-soft: 0 6px 20px rgba(15, 23, 42, 0.08);
    --primary-color: #1f9d8f;
    --text-primary: #0f172a;
    --text-secondary: #475569;
}

/* =====================================================
   BASE MOBILE STYLES (320px+)
   ===================================================== */

/* Touch-friendly targets - WCAG 2.5.5 compliant */
.btn, .nav-link, .dropdown-item, .form-control, .form-select {
    min-height: 44px;
    padding: 0.75rem 1rem;
}

/* Touch target improvement for small buttons */
.btn-sm {
    min-height: 40px;
    padding: 0.5rem 0.875rem;
}

/* Improve touch targets for interactive elements */
a, button, [role="button"], input[type="checkbox"], input[type="radio"] {
    touch-action: manipulation;
}

/* Mobile typography */
html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

h1, .h1 { font-size: 1.75rem; }
h2, .h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.25rem; }
h4, .h4 { font-size: 1.125rem; }

/* Mobile container */
.container, .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Mobile header */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar {
    padding: 0.5rem 0;
}

.navbar-brand {
    font-size: 1.25rem;
}

.navbar-brand .logo-circle {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

/* Mobile search - responsive width */
.search-input {
    width: 100%;
    min-width: auto;
    max-width: 100%;
}

.search-input .form-control {
    border-radius: 25px 0 0 25px;
    padding-left: 1rem;
    min-width: 120px;
}

.search-input .btn {
    border-radius: 0 25px 25px 0;
    padding: 0.5rem 1rem;
    min-width: 44px;
}

/* Mobile navigation */
.navbar-collapse {
    background: var(--white-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    box-shadow: var(--shadow-soft);
}

.navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    min-height: 48px;
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link:last-child {
    border-bottom: none;
}

/* Mobile action bar with scroll indicator */
.actions-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: relative;
}

.actions-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
}

.actions-bar::-webkit-scrollbar {
    display: none;
}

.quick-links {
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* Mobile categories scroll */
.categories-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-card.modern-category {
    flex-shrink: 0;
    min-width: 100px;
    padding: 0.75rem 1rem;
}

/* Mobile cards */
.game-card, .marketplace-item, .feature-card {
    margin-bottom: 1rem;
}

.game-card img {
    height: 180px;
    object-fit: cover;
}

/* Mobile grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

/* Mobile hero */
.hero-section, .hero-section-enhanced {
    padding: 80px 0 40px;
    min-height: auto;
}

.hero-title {
    font-size: 1.75rem;
    line-height: 1.3;
}

.hero-subtitle {
    font-size: 1rem;
}

/* Mobile forms */
.form-group {
    margin-bottom: 1rem;
}

.form-control, .form-select {
    font-size: 16px; /* Prevents zoom on iOS */
}

/* Mobile buttons */
.btn-group-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-group-mobile .btn {
    width: 100%;
}

/* Mobile tables */
.table-responsive-mobile {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile modals */
.modal-dialog {
    margin: 0.5rem;
}

.modal-content {
    border-radius: var(--radius-md);
}

/* Mobile footer */
.footer {
    padding: 2rem 0;
}

.footer-links {
    text-align: center;
}

/* Bottom navigation for mobile */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1040;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    text-align: center;
}

.mobile-bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: none;
}

.mobile-bottom-nav .nav-link i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.mobile-bottom-nav .nav-link.active {
    color: var(--primary-color);
}

/* Add padding to body for bottom nav */
body.has-bottom-nav {
    padding-bottom: 70px;
}

/* Hide desktop elements on mobile */
.desktop-only {
    display: none !important;
}

/* =====================================================
   TABLET STYLES (576px+)
   ===================================================== */
@media (min-width: 576px) {
    html {
        font-size: 15px;
    }
    
    .container, .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .game-card img {
        height: 200px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .btn-group-mobile {
        flex-direction: row;
    }
    
    .btn-group-mobile .btn {
        width: auto;
    }
}

/* =====================================================
   MEDIUM TABLET STYLES (768px+)
   ===================================================== */
@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
    
    h1, .h1 { font-size: 2rem; }
    h2, .h2 { font-size: 1.75rem; }
    h3, .h3 { font-size: 1.5rem; }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    
    .hero-section, .hero-section-enhanced {
        padding: 100px 0 60px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    /* Hide mobile bottom nav on tablets */
    .mobile-bottom-nav {
        display: none;
    }
    
    body.has-bottom-nav {
        padding-bottom: 0;
    }
    
    .tablet-only {
        display: block !important;
    }
}

/* =====================================================
   DESKTOP STYLES (992px+)
   ===================================================== */
@media (min-width: 992px) {
    html {
        font-size: 16px;
    }
    
    h1, .h1 { font-size: 2.5rem; }
    h2, .h2 { font-size: 2rem; }
    h3, .h3 { font-size: 1.75rem; }
    
    .container, .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .navbar-collapse {
        background: transparent;
        padding: 0;
        margin-top: 0;
        box-shadow: none;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
        border-bottom: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    .hero-section, .hero-section-enhanced {
        padding: 120px 0 80px;
        min-height: 85vh;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .desktop-only {
        display: block !important;
    }
    
    .mobile-only {
        display: none !important;
    }
}

/* =====================================================
   LARGE DESKTOP STYLES (1200px+)
   ===================================================== */
@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
}

/* =====================================================
   EXTRA LARGE DESKTOP (1400px+)
   ===================================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .products-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 1.5em;
    width: 80%;
}

.skeleton-image {
    height: 200px;
    width: 100%;
}

/* Pull to refresh indicator */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 9999;
    transition: transform 0.3s ease;
}

.ptr-indicator.active {
    transform: translateX(-50%) translateY(0);
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }
    
    .main-header {
        padding-top: env(safe-area-inset-top);
    }
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control, .form-select {
        border-width: 2px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: #1a1a2e;
        --input-bg: #16213e;
        --text-primary: #eaeaea;
        --text-secondary: #b0b0b0;
        --border-color: #2d2d44;
    }
}
