﻿/* ============================================================================
   ParalinkPOS — Mobile-First UI/UX Stilleri (v2 - Hata Düzeltilmiş & Optimize)
   Alt Gezinme (Bottom Nav), Akıllı Kartlar, Kompakt Paketler & Çekmeceler
   ============================================================================ */

:root {
  /* Mobil Dokunmatik & Boyut Değişkenleri */
  --touch-target-min: 44px;
  --bottom-nav-height: 56px;
  --header-mobile-height: 54px;

  /* Safe Area Insets (iOS Çentik & Home Indicator) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* ----------------------------------------------------------------------------
   1. Genel Mobil Sıfırlamalar & Dokunma Davranışları
   ---------------------------------------------------------------------------- */
.btn,
.nav-item,
.package-card,
.mobile-license-card,
.mobile-log-card,
.filter-chip,
.bottom-nav-item,
.btn-touch-action {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-sizing: border-box;
}

.btn:active,
.mobile-license-card:active,
.mobile-log-card:active,
.filter-chip:active,
.btn-touch-action:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* iOS Safari Input Otomatik Zoom Engelleme & Kutu Boyutlandırma */
@media (max-width: 767px) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .card {
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
  }

  .card-header {
    padding: 0.875rem 1rem;
  }

  .card-body {
    padding: 1rem;
  }
}

/* ----------------------------------------------------------------------------
   2. Duyarlı Görünüm Değiştiriciler (Responsive Switcher)
   ---------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .desktop-table-view {
    display: none !important;
  }
  .mobile-cards-view {
    display: block !important;
  }
  .desktop-filter-bar {
    display: none !important;
  }
  .mobile-filter-header {
    display: flex !important;
  }
}

@media (min-width: 768px) {
  .desktop-table-view {
    display: block !important;
  }
  .mobile-cards-view {
    display: none !important;
  }
  .desktop-filter-bar {
    display: flex !important;
  }
  .mobile-filter-header {
    display: none !important;
  }
  .bottom-nav-bar {
    display: none !important;
  }
}

/* ----------------------------------------------------------------------------
   3. Sabit Alt Gezinme Çubuğu (Bottom Navigation Bar)
   ---------------------------------------------------------------------------- */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--sab));
  padding-bottom: var(--sab);
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 150;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: var(--slate-400);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  gap: 0.15rem;
  transition: all var(--transition-fast);
  position: relative;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
  color: var(--slate-200);
  text-decoration: none;
}

.bottom-nav-item.active {
  color: #38bdf8;
  font-weight: 700;
}

.bottom-nav-item.active .bottom-nav-icon {
  transform: translateY(-1px);
}

.bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav-label {
  letter-spacing: 0.01em;
  font-size: 0.6875rem;
}

/* FAB (Floating Action Button) Stili Yeni Üret Butonu */
.bottom-nav-fab {
  position: relative;
  top: -8px;
}

.bottom-nav-fab-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--primary-500) 0%,
    var(--primary-700) 100%
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow:
    0 4px 12px var(--primary-glow),
    0 0 0 3px #0f172a;
  transition: transform var(--transition-fast);
}

.bottom-nav-item.active .bottom-nav-fab-icon {
  box-shadow:
    0 4px 16px var(--primary-glow),
    0 0 0 3px #0f172a;
  transform: scale(1.05);
}

/* ----------------------------------------------------------------------------
   4. Akıllı Mobil Lisans Kartları (Adaptive License Cards)
   ---------------------------------------------------------------------------- */
.mobile-license-list,
.mobile-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.mobile-license-card,
.mobile-log-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  padding: 0.875rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.mobile-license-card:hover,
.mobile-log-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--slate-300);
}

/* Sol Durum Şeridi */
.mobile-license-card::before,
.mobile-log-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.border-status-success::before {
  background: var(--success-500);
}
.border-status-warning::before {
  background: var(--warning-500);
}
.border-status-danger::before {
  background: var(--danger-500);
}
.border-status-primary::before {
  background: var(--primary-500);
}
.border-status-info::before {
  background: var(--info-500);
}
.border-status-muted::before {
  background: var(--slate-300);
}

/* Kart İç Satırları */
.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
}

.card-id-pack {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-wrap: wrap;
}

.card-id {
  font-weight: 800;
  font-size: 0.8125rem;
  color: var(--slate-700);
}

.card-hash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--slate-50);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
}

.hash-code-mobile {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--slate-800);
  word-break: break-all;
  font-weight: 600;
  min-width: 0;
  flex: 1;
}

.card-actions-inline {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-touch-action {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: white;
  border: 1px solid var(--slate-300);
  color: var(--slate-700);
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-touch-action:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.btn-touch-action.btn-touch-primary {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary-700);
}

.card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--slate-500);
  border-top: 1px solid var(--slate-100);
  padding-top: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.card-terminal-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.card-date-text {
  font-size: 0.6875rem;
  color: var(--slate-400);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------------------
   5. Hızlı Filtre Çipleri & Mobil Arama (Filter Chips)
   ---------------------------------------------------------------------------- */
.mobile-filter-header {
  display: none;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.mobile-search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.mobile-search-input-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.mobile-search-input-wrap input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2rem !important;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-300);
  font-size: 0.875rem !important;
  background: white;
  outline: none;
  box-sizing: border-box;
}

.mobile-search-icon {
  position: absolute;
  left: 0.625rem;
  color: var(--slate-400);
  font-size: 0.875rem;
  pointer-events: none;
}

.btn-open-filter-sheet {
  min-height: 38px;
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid var(--slate-300);
  color: var(--slate-700);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-badge-count {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-600);
  color: white;
  font-size: 0.625rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.filter-chips-scroll {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
  width: 100%;
  box-sizing: border-box;
}

.filter-chips-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--slate-200);
  background: white;
  color: var(--slate-700);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all var(--transition-fast);
  text-decoration: none;
  flex-shrink: 0;
}

.filter-chip:hover {
  border-color: var(--primary-300);
  background: var(--slate-50);
  text-decoration: none;
}

.filter-chip.active {
  background: var(--primary-600);
  color: white;
  border-color: var(--primary-600);
  font-weight: 600;
  box-shadow: 0 1px 4px var(--primary-glow);
}

/* ----------------------------------------------------------------------------
   6. Alttan Açılan Çekmece (Bottom Sheet Drawer)
   ---------------------------------------------------------------------------- */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  z-index: 1001;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
  padding: 1rem 1rem calc(1.25rem + var(--sab));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--slate-300);
  border-radius: var(--radius-full);
  margin: -0.25rem auto 0.75rem;
  flex-shrink: 0;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--slate-100);
  margin-bottom: 1rem;
}

.bottom-sheet-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.bottom-sheet-close {
  background: var(--slate-100);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 0.875rem;
  color: var(--slate-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bottom-sheet-close:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.bottom-sheet-body {
  flex: 1;
  overflow-y: auto;
}

.bottom-sheet-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--slate-100);
}

/* ----------------------------------------------------------------------------
   7. Mobil Paket Seçim Grid'i (Kompakt 2x2 Yerleşim)
   ---------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .package-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    margin-bottom: 1rem;
  }

  .package-card {
    padding: 0.75rem;
    border-radius: var(--radius-md);
  }

  .package-header {
    gap: 0.5rem;
    margin-bottom: 0.35rem;
  }

  .package-icon {
    font-size: 1.25rem;
  }

  .package-title {
    font-size: 0.875rem;
  }

  .package-desc {
    font-size: 0.6875rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .duration-pills {
    gap: 0.35rem;
  }

  .duration-pill {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }
}

/* ----------------------------------------------------------------------------
   8. Mobil KPI Stat Kartları (Kompakt 2 Sütun Grid)
   ---------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
  }

  .stat-card {
    padding: 0.75rem 0.875rem;
    border-radius: var(--radius-md);
    box-sizing: border-box;
  }

  .stat-card-top {
    margin-bottom: 0.25rem;
  }

  .stat-card-label {
    font-size: 0.6875rem;
    font-weight: 700;
  }

  .stat-card-icon {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
  }

  .stat-card-value {
    font-size: 1.375rem;
    font-weight: 800;
  }

  .stat-card-footer {
    display: none;
  }
}
