/* ==========================================================================
   RSI MARBLE — MOBİL & IPHONE İÇİN ÖZEL ULTRA-UYUMLU ARAYÜZ (mobile.css)
   iOS Safe Area, Alt Tab Bar, Dokunmatik Büyük Alanlar & Safari Zoom Önleyici
   ========================================================================== */

/* iPhone Safe Area Desteği */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-tabbar-height: 64px;
}

/* Safari Otomatik Zoom Engelleme (Yazı boyutu min 16px) */
@media screen and (max-width: 768px) {
  input, select, textarea, button {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   MOBİL EKRAN STİLLERİ (<= 768px - iPhone & Android)
   ========================================================================== */
@media (max-width: 768px) {

  /* Ana Taşıyıcı ve Boşluklar */
  .app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-bottom: calc(var(--mobile-tabbar-height) + var(--safe-bottom));
  }

  /* Sol Sidebar'ı Mobilde Gizle (Alt Menü ve Mobil Çekmece Devreye Girer) */
  .app-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 320px;
    height: 100%;
    z-index: 999;
    background: #FFFFFF;
    border-right: 1px solid var(--border-subtle);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .app-sidebar.mobile-open {
    display: flex;
    transform: translateX(0);
  }

  /* Mobil Karartma Overlay */
  #mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 998;
  }

  #mobile-menu-overlay.active {
    display: block;
  }

  /* Mobil Üst Çubuk (Header) */
  .app-header {
    height: auto;
    min-height: 56px;
    padding: calc(8px + var(--safe-top)) 12px 8px 12px;
    flex-direction: column;
    gap: 8px;
    background: #1A2126;
    border-bottom: 1px solid var(--border-medium);
  }

  .header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .mobile-brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-logo-img {
    height: 32px;
    width: auto;
    max-width: 110px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  }

  .mobile-page-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--rsi-gold-light);
  }

  /* Canlı Döviz ve Kullanıcı Şeridi (Mobilde Kompakt) */
  .quick-stats-strip {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 4px;
    overflow-x: auto;
    padding: 2px 0;
  }

  .stat-pill {
    padding: 4px 8px;
    font-size: 0.72rem;
    flex: 1;
    justify-content: center;
    white-space: nowrap;
  }

  /* Ana İçerik Alanı */
  .app-main {
    padding: 12px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Kartlar ve Gridler (Mobilde Tek Kolon) */
  .grid-cards-4,
  .grid-cards-3,
  .grid-cards-2,
  .grid-cards-1 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .rsi-card {
    padding: 14px 12px;
    border-radius: var(--radius-md);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Dokunmatik Büyük Butonlar ve Girişler */
  .touch-btn {
    min-height: 46px;
    padding: 12px 16px;
    font-size: 0.9rem !important;
    font-weight: 600;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-md);
  }

  .touch-input {
    min-height: 44px;
    font-size: 16px !important; /* iOS zoom önleyici */
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  /* Tablolar (Mobilde Kart Tarzı veya Yatay Kaydırma) */
  .table-responsive {
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
  }

  .rsi-table th, 
  .rsi-table td {
    padding: 8px 6px;
    font-size: 0.75rem;
  }

  /* ==========================================================================
     IPHONE ALT TAB BAR (NATIVE MOBILE DENEYİMİ)
     ========================================================================== */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-tabbar-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: #FFFFFF;
    border-top: 1px solid var(--border-subtle);
    z-index: 990;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    color: var(--rsi-slate-400);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    cursor: pointer;
  }

  .mobile-nav-item .mob-icon {
    font-size: 1.3rem;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item.active {
    color: var(--rsi-gold-light);
  }

  .mobile-nav-item.active .mob-icon {
    transform: translateY(-2px) scale(1.1);
  }
}

/* Masaüstünde Mobil Alt Çubuğu Gizle */
@media (min-width: 769px) {
  .mobile-bottom-nav,
  #mobile-menu-overlay,
  .mobile-header-bar {
    display: none !important;
  }
}
