/* ============================================================
   THIMI INVESTMENT GROUP — GLOBAL STYLES + MOBILE RESPONSIVE
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
}

body {
  background: #f0f2f5;
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

#sidebar {
  width: 250px;
  background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  color: white;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

#sidebar .sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#sidebar .sidebar-brand h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: 0.3px;
}

#sidebar .sidebar-close {
  display: none;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

#sidebar .sidebar-close:hover {
  color: #fff;
}

#sidebar a {
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  padding: 0.8rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

#sidebar a i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

#sidebar a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-left-color: rgba(99, 179, 237, 0.5);
}

#sidebar a.active {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
  border-left-color: #3b82f6;
}

/* Overlay backdrop (mobile) */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1035;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.3s;
}

#sidebarOverlay.show {
  display: block;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
  margin-left: 250px;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.navbar-brand {
  font-size: 1rem;
  font-weight: 600;
}

#menu-toggle {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 1.2rem;
  transition: background 0.2s;
}

#menu-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  border: none;
  border-radius: 14px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.07);
}

.card-header {
  border-radius: 14px 14px 0 0 !important;
  padding: 0.85rem 1.1rem;
  font-weight: 600;
}

footer {
  margin-top: 30px;
}

/* ---------- Stat Cards ---------- */
.card.shadow .card-body {
  padding: 0.85rem 0.75rem;
  word-wrap: break-word;
}

.card.shadow .fs-4,
.card.shadow .fs-5 {
  font-size: 1.25rem !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card.shadow small {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-top: 4px;
  opacity: 0.85;
}

/* ============================================================
   TABS (scrollable on mobile)
   ============================================================ */

#adminTabs {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  gap: 2px;
}

#adminTabs::-webkit-scrollbar {
  height: 3px;
}

#adminTabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

#adminTabs .nav-item {
  flex: 0 0 auto;
}

#adminTabs .nav-link {
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 12px 12px;
}

.table {
  margin-bottom: 0;
}

/* All table headers — ensure text is always visible */
.table thead th {
  font-size: 0.82rem;
  white-space: nowrap;
  font-weight: 600;
  color: #1e293b !important;
  background-color: #f1f5f9;
  border-bottom: 2px solid #e2e8f0;
}

/* Dark table headers — bright white text on dark slate */
.table thead.table-dark th,
.table-dark thead th,
.table-dark th {
  color: #ffffff !important;
  background-color: #1e293b !important;
  border-bottom: 2px solid #334155;
}

.table tbody td {
  font-size: 0.84rem;
  vertical-align: middle;
  color: #1e293b;
}


/* Nav tabs inside card headers */
.nav-tabs .nav-link {
  color: #374151 !important;
  font-weight: 600;
}

.nav-tabs .nav-link.active {
  color: #111827 !important;
  font-weight: 700;
}

.nav-tabs .nav-link:hover {
  color: #111827 !important;
}

/* ============================================================
   MEMBER DASHBOARD
   ============================================================ */

.member-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ============================================================
   FINANCIAL SUMMARY NUMBERS
   ============================================================ */

#fin_total_collected,
#fin_total_cash,
#fin_share_invested,
#fin_share_value,
#fin_loan_total,
#fin_interest_total,
#fin_share_loss,
#fin_pawan_bank {
  font-size: 1.05rem !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */

.d-flex.justify-content-between {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ============================================================
   ====  TABLET  (≤ 992px)  ====
   ============================================================ */
@media (max-width: 992px) {
  #sidebar {
    transform: translateX(-100%);
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar .sidebar-close {
    display: block;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .navbar-brand {
    display: block !important;
  }
}

/* ============================================================
   ====  MOBILE  (≤ 768px)  ====
   ============================================================ */
@media (max-width: 768px) {
  .container-fluid.mt-4 {
    margin-top: 0.75rem !important;
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Page title */
  .d-flex.justify-content-between h2 {
    font-size: 1.1rem;
  }

  /* Buttons row — allow wrapping */
  .d-flex.gap-2 {
    flex-wrap: wrap;
  }

  /* Card header action buttons */
  .card-header .d-flex {
    flex-wrap: wrap;
    gap: 6px !important;
  }

  .card-header .btn {
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
  }

  /* Stat cards: 2-per-row */
  .row.g-3>.col-md-2,
  .row.g-3>.col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  /* Stat text */
  .card.shadow .fs-4,
  .card.shadow .fs-5 {
    font-size: 1.05rem !important;
  }

  .card.shadow small {
    font-size: 0.65rem;
  }

  /* Financial numbers */
  #fin_total_collected,
  #fin_total_cash,
  #fin_share_invested,
  #fin_share_value,
  #fin_loan_total,
  #fin_interest_total,
  #fin_share_loss,
  #fin_pawan_bank {
    font-size: 0.95rem !important;
  }

  /* Tables */
  .table thead th {
    font-size: 0.75rem;
    padding: 0.45rem 0.5rem;
  }

  .table thead.table-dark th,
  .table-dark thead th {
    color: #ffffff !important;
  }


  .table tbody td {
    font-size: 0.78rem;
    padding: 0.45rem 0.5rem;
  }

  .table .badge {
    font-size: 0.68rem;
    padding: 0.2em 0.45em;
  }

  /* Tab links */
  #adminTabs .nav-link {
    font-size: 0.78rem;
    padding: 0.4rem 0.65rem;
  }

  /* Member dashboard header */
  .container.py-4 {
    padding: 0.75rem !important;
  }

  h5.fw-bold.mb-3 {
    font-size: 0.95rem;
  }

  /* Modals */
  .modal-dialog {
    margin: 0.5rem;
  }
}

/* ============================================================
   ====  EXTRA SMALL  (≤ 576px)  ====
   ============================================================ */
@media (max-width: 576px) {
  .card.shadow .card-body {
    padding: 0.6rem 0.5rem;
  }

  /* Stat cards: full width stacked */
  .row.g-3>.col-md-2,
  .row.g-3>.col-md-3,
  .row.g-3>.col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .card.shadow .fs-4,
  .card.shadow .fs-5 {
    font-size: 0.95rem !important;
  }

  .card.shadow small {
    font-size: 0.6rem;
  }

  #adminTabs .nav-link {
    font-size: 0.74rem;
    padding: 0.35rem 0.55rem;
  }

  /* Member dashboard summary cards on mobile */
  .member-header {
    padding: 0.5rem 0.75rem;
  }

  .card-body h6.text-uppercase {
    font-size: 0.68rem !important;
    letter-spacing: 0.2px;
    margin-bottom: 2px;
  }

  .card-body h3 {
    font-size: 1.05rem !important;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
  }

  .card-body h4 {
    font-size: 1rem !important;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
  }

  /* Member dashboard: stat cards full width */
  .col-md-4.mb-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Action buttons full width */
  .d-flex.justify-content-between>div {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Navbar brand */
  .navbar-brand {
    font-size: 0.9rem;
  }

  h2 {
    font-size: 1.1rem !important;
  }
}

/* ============================================================
   MEMBER DASHBOARD SPECIFIC MOBILE REFINEMENTS
   ============================================================ */
@media (max-width: 768px) {
  .member-stat-card .card-body {
    padding: 0.75rem 0.65rem;
  }
  
  .member-stat-title {
    font-size: 0.72rem !important;
    min-height: 28px;
    display: flex;
    align-items: center;
  }

  .member-stat-value {
    font-size: 1.12rem !important;
    word-break: break-word;
    line-height: 1.2;
  }
}