/* ============================================================
   TOBE SYSTEM - Mobile-First & Touch-Optimized Stylesheet
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --mobile-nav-height: 64px;
  --touch-target-min: 44px;
  --mobile-bg-dark: #0f1115;
  --mobile-yellow: #ffc107;
  --mobile-card-bg: #ffffff;
  --mobile-border-soft: #e5e7eb;
}

/* ---------- Global Mobile Fixes ---------- */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Prevent horizontal overflow on mobile body */
.page-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
}

@media (max-width: 768px) {
  .page-wrap {
    margin: 12px auto;
    padding: 0 12px;
  }
}

/* Base Spacer to prevent content being covered by Mobile Bottom Nav */
.mobile-bottom-spacer {
  height: 80px;
  display: block;
}

@media (min-width: 992px) {
  .mobile-bottom-spacer {
    display: none;
  }
}

/* ---------- Touch Target Optimization (≥ 44px) ---------- */
button, 
.btn, 
.form-control, 
.form-select, 
.nav-link {
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
}

.btn {
  justify-content: center;
  border-radius: 12px;
  font-weight: 600;
  padding: 8px 16px;
}

.form-control, .form-select {
  border-radius: 12px;
  font-size: 0.95rem;
  padding: 10px 14px;
}

/* ---------- Mobile Bottom Navigation Bar ---------- */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background-color: var(--mobile-bg-dark);
  border-top: 1px solid rgba(255, 193, 7, 0.25);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  z-index: 1050;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 4px 8px;
  backdrop-filter: blur(10px);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 0;
  transition: all 0.2s ease;
  border-radius: 10px;
}

.mobile-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  color: rgba(255, 255, 255, 0.9);
}

.mobile-nav-item.active {
  color: var(--mobile-yellow);
  font-weight: 700;
}

.mobile-nav-item.active i {
  transform: translateY(-2px) scale(1.1);
  color: var(--mobile-yellow);
}

/* Badge on nav icon */
.mobile-nav-item .badge {
  position: absolute;
  top: 6px;
  right: 22%;
  font-size: 0.65rem;
  padding: 2px 5px;
}

/* ---------- Touch Offcanvas Drawer ---------- */
.offcanvas-mobile-drawer {
  background-color: var(--mobile-bg-dark) !important;
  color: #ffffff;
  width: 280px !important;
  border-right: 1px solid rgba(255, 193, 7, 0.2);
}

.offcanvas-mobile-drawer .offcanvas-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 16px;
}

.offcanvas-mobile-drawer .nav-link {
  color: rgba(255, 255, 255, 0.8);
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.offcanvas-mobile-drawer .nav-link i {
  font-size: 1.2rem;
  width: 28px;
}

.offcanvas-mobile-drawer .nav-link.active,
.offcanvas-mobile-drawer .nav-link:hover {
  background: rgba(255, 193, 7, 0.15);
  color: var(--mobile-yellow);
}

/* ---------- Mobile Card Views for Tables ---------- */
@media (max-width: 768px) {
  .table-responsive-cards thead {
    display: none; /* Hide header on mobile */
  }

  .table-responsive-cards tbody tr {
    display: block;
    background: var(--mobile-card-bg);
    border: 1px solid var(--mobile-border-soft);
    border-radius: 14px;
    margin-bottom: 12px;
    padding: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  }

  .table-responsive-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border: none;
    border-bottom: 1px dashed #f0f0f0;
    font-size: 0.9rem;
  }

  .table-responsive-cards tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .table-responsive-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    font-size: 0.85rem;
    margin-right: 12px;
  }
}

/* ---------- Touch Sticky Action Bar ---------- */
.mobile-sticky-action {
  position: fixed;
  bottom: calc(var(--mobile-nav-height) + 10px);
  left: 12px;
  right: 12px;
  z-index: 1040;
  background: #ffffff;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--mobile-border-soft);
}

@media (min-width: 992px) {
  .mobile-sticky-action {
    position: static;
    box-shadow: none;
    padding: 0;
    border: none;
  }
}

/* ---------- Responsive Font Utilities ---------- */
@media (max-width: 576px) {
  h1, .h1 { font-size: 1.5rem !important; }
  h2, .h2 { font-size: 1.3rem !important; }
  h3, .h3 { font-size: 1.15rem !important; }
  .kpi-number { font-size: 1.6rem !important; }
}
