/* ==========================================================================
   Tankerford Cloud - Unified Admin Theme
   ==========================================================================
   - Consistent light layout
   - Modern purple branding
   - Optimized for both web & mobile
   ==========================================================================
*/

/* ===== Core Variables ===== */
:root {
  --tf-purple: #6f42c1;
  --tf-purple-light: #f5f3ff;
  --tf-purple-border: #e1defa;
  --tf-purple-dark: #563d7c;
  --primary: var(--tf-purple);
  --primary-dark: var(--tf-purple-dark);
  --bg-light: #f8f9fa;
  --text-dark: #353535;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #f9b233;
  --border-light: #e0e0e0;
  --sidebar-bg: var(--tf-purple);
  --sidebar-hover: rgba(255, 255, 255, 0.15);
  --card-bg: #fff;
}

/* ===== Global ===== */
body {
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  margin: 0;
  padding-top: 83px; /* offset for fixed header - matches header.php */
  overflow-x: hidden;
}

/* ==========================================================================
   Header
   ========================================================================== */
.tk-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 83px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  /* NOTE: Do NOT set display here - let header.php and Bootstrap handle layout */
}

.tk-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tk-logo {
  height: 60px;
}

.tk-nav .nav-link {
  color: var(--text-dark);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s, border-bottom 0.2s;
  padding-bottom: 3px;
}
.tk-nav .nav-link:hover,
.tk-nav .nav-link.active {
  color: var(--tf-purple);
  border-bottom: 2px solid var(--tf-purple);
}

.tk-header .btn {
  color: var(--text-dark);
  font-size: 1.4rem;
}
.tk-header .btn:hover {
  color: var(--tf-purple);
}

/* User icon */
#userMenu {
  width: 48px;
  height: 48px;
  font-size: 18px;
  background: #fff;
  color: var(--text-dark);
  border: 1px solid var(--border-light);
  transition: 0.2s ease;
}
#userMenu:hover {
  background: var(--tf-purple);
  color: #fff;
}

/* ==========================================================================
   Left Sidebar (Admin)
   ========================================================================== */
.tk-sidebar {
  position: fixed;
  top: 83px;
  left: 0;
  width: 260px;
  height: calc(100% - 83px);
  background: var(--sidebar-bg);
  color: #fff;
  overflow-y: auto;
  z-index: 900;
  transition: left 0.3s ease;
}
.tk-sidebar.open {
  left: 0;
}
.tk-sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.tk-sidebar h6 {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}
.tk-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tk-sidebar a {
  display: block;
  padding: 10px 18px;
  text-decoration: none;
  color: #fff;
  border-radius: 6px;
  margin: 3px 8px;
  transition: background 0.2s ease;
  font-weight: 500;
}
.tk-sidebar a:hover,
.tk-sidebar a.active {
  background: var(--sidebar-hover);
}
.tk-sidebar i {
  margin-right: 10px;
  font-size: 1.1rem;
}

/* ==========================================================================
   Right Sidebar (Online Users)
   ========================================================================== */
.tk-right-sidebar {
  position: fixed;
  top: 83px;
  right: -320px;
  width: 300px;
  height: calc(100% - 83px);
  background: #fff;
  border-left: 4px solid var(--tf-purple);
  overflow-y: auto;
  transition: right 0.3s ease;
  z-index: 950;
}
.tk-right-sidebar.open {
  right: 0;
}
.tk-right-sidebar h6 {
  color: var(--tf-purple);
}
.tk-right-sidebar li {
  border-bottom: 1px solid #eee;
  padding: 4px 0;
}

/* ==========================================================================
   Cards & Tables
   ========================================================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}
.card-header {
  font-weight: 600;
  font-size: 1.05rem;
}
.card-header.bg-purple {
  background: var(--tf-purple) !important;
  color: #fff !important;
}
.table {
  font-size: 0.9rem;
}
.table th {
  background-color: #f3f3f7;
  font-weight: 600;
}
.table td,
.table th {
  vertical-align: middle;
}
.table-hover tbody tr:hover {
  background-color: var(--tf-purple-light);
  transition: background 0.2s;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
  background-color: var(--tf-purple);
  border-color: var(--tf-purple);
}
.btn-primary:hover {
  background-color: var(--tf-purple-dark);
  border-color: var(--tf-purple-dark);
}
.btn-outline-purple {
  color: var(--tf-purple);
  border-color: var(--tf-purple-border);
}
.btn-outline-purple:hover {
  background-color: var(--tf-purple-light);
  border-color: var(--tf-purple);
}

/* ==========================================================================
   Dashboard & Layout Enhancements
   ========================================================================== */
.dashboard-filter-card {
  background: var(--tf-purple-light);
  border: 1px solid var(--tf-purple-border);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  max-width: 900px;
  margin: 0 auto 1.5rem auto;
}
.dashboard-footer {
  text-align: center;
  color: #6c757d;
  font-size: 0.9rem;
  margin-top: 2rem;
  padding-bottom: 2rem;
}
.text-purple {
  color: var(--tf-purple) !important;
}

/* ==========================================================================
   Layout Alignment Fixes
   ========================================================================== */
.tk-main {
  padding: 1.5rem;
  padding-top: 2rem;
  margin-left: 260px;
}
.container {
  max-width: calc(100% - 280px);
  margin-left: 280px;
}
body.has-sidebar .container {
  margin-left: 280px;
}

/* ==========================================================================
   Responsive Behavior
   ========================================================================== */
@media (max-width: 991.98px) {
  #adminSidebar {
    display: none !important;
  }
  .tk-main,
  .container {
    margin-left: 0 !important;
    padding: 1rem;
    max-width: 100%;
  }
  .tk-header {
    height: 70px;
  }
  .tk-logo {
    height: 48px;
  }
  body {
    padding-top: 70px;
  }
  .offcanvas {
    width: 80%;
    background: #fff;
  }
  .offcanvas .list-group-item {
    border: none;
    font-size: 1.05rem;
  }
  .offcanvas .list-group-item a {
    color: #333;
    display: block;
  }
  .offcanvas .list-group-item a:hover {
    color: var(--tf-purple);
  }
}

/* ==========================================================================
   Utility & Misc
   ========================================================================== */
a {
  color: var(--tf-purple);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.text-success i,
.text-danger i,
.text-secondary i {
  font-size: 0.95rem;
}


/* --- Step 3 mobile polish --- */
@media (max-width: 991.98px) {
  /* hide user lozenge on mobile; identity is shown in offcanvas menu instead */
  #userMenu { display: none !important; }
  .user-lozenge { display: none !important; }

  /* larger tap targets */
  .offcanvas .list-group-item {
    padding: 0.9rem 1rem;
    font-size: 1.1rem;
  }
  .offcanvas .list-group-item i {
    font-size: 1.25rem;
    margin-right: 0.55rem;
    vertical-align: -2px;
  }

  /* menus are 80% width */
  .offcanvas { width: 80% !important; }

  /* header buttons bigger */
  .tk-header .btn { font-size: 1.6rem; }

  /* purple card headers (ensure contrast on mobile) */
  .card-header.bg-purple { background: var(--tf-purple) !important; color: #fff !important; }
}

/* keep desktop admin sidebar visible and content aligned */
@media (min-width: 992px) {
  body.has-sidebar .container { margin-left: 280px; }
  #adminSidebar { display: block !important; }
}

.offcanvas .btn-close {
  filter: none !important;
  opacity: 1 !important;
}
.offcanvas .btn-close::before {
  color: #555 !important;
}
/* ========================================================================
   Tankerford Cloud — User Administration UI Enhancements
   ======================================================================== */

/* Lozenge-style site selectors */
.badge.bg-purple,
.badge.bg-light {
  border-radius: 50px !important;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem !important;
  transition: all 0.15s ease-in-out;
}
.badge.bg-light {
  background-color: #f8f9fa !important;
  border: 1px solid #ddd !important;
}
.badge.bg-purple {
  background-color: var(--tf-purple) !important;
  color: #fff !important;
}
.badge.bg-purple:hover {
  background-color: var(--tf-purple-dark) !important;
}

/* Buttons */
.btn-outline-purple {
  color: var(--tf-purple) !important;
  border-color: var(--tf-purple-border) !important;
}
.btn-outline-purple:hover {
  background: var(--tf-purple-light) !important;
  color: var(--tf-purple-dark) !important;
}

/* Table adjustments for admin page */
.table td, .table th {
  vertical-align: middle !important;
}
.table th {
  background: #f7f6ff;
  color: #3d316f;
  border-bottom: 2px solid #e7e3fa;
}
.table-hover tbody tr:hover {
  background-color: #f3f0ff !important;
}

/* Modal styling */
.modal-content {
  border-radius: 1rem !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.modal-header {
  background: var(--tf-purple);
  color: #fff;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
}
.modal-header .btn-close {
  filter: invert(1) grayscale(100%);
}
.modal-body label {
  font-weight: 500;
}
.modal-footer .btn-primary {
  background: var(--tf-purple);
  border: none;
}
.modal-footer .btn-primary:hover {
  background: var(--tf-purple-dark);
}

/* Page heading */
h3.text-purple {
  font-weight: 600;
  font-size: 1.6rem;
}

/* Purple brand */
.text-purple { color: #6f42c1 !important; }

/* Offcanvas styling */
.tk-offcanvas {
    border-radius: 0 12px 12px 0;
}

/* Right offcanvas (admin) */
.offcanvas-end.tk-offcanvas {
    border-radius: 12px 0 0 12px;
}

/* Pretty list items */
.tk-menu-list .list-group-item {
    font-size: 1.1rem;
    padding: 14px 10px;
}

.tk-menu-list .list-group-item a {
    text-decoration: none;
    color: #333;
}

.tk-menu-list .list-group-item:hover {
    background: #f5f0ff;
}

/* Improve close button visibility */
.btn-close-white {
    filter: invert(1);
}

/* ============================================
   BEST SELLERS TABLE STYLES
   ============================================ */

.best-sellers-table {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

/* Table header */
.best-sellers-table thead th {
    background: #6f42c1 !important; /* Tankerford Purple */
    color: #fff !important;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Hover sort indication */
.best-sellers-table thead th:hover {
    background: #5932a5 !important;
}

/* Table body */
.best-sellers-table tbody td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Responsive handling */
.best-sellers-table.table-responsive {
    overflow-x: auto;
}

/* Mobile support */
@media (max-width: 576px) {
    .best-sellers-table table {
        font-size: 0.85rem;
    }

    .best-sellers-table tbody td {
        white-space: nowrap;
    }

    .best-sellers-table thead th {
        font-size: 0.9rem;
    }

    .best-sellers-table tbody td:nth-child(1) {
        max-width: 150px;
        white-space: normal !important;
    }
}

/* Section title */
.report-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #6f42c1;
    margin-bottom: 0.75rem;
}

/* Report block wrapper */
.report-block {
    background: #ffffff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.report-tabs {
    gap: 8px;
}

.tab-btn {
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    background: #eee;
}

.tab-btn.active {
    background: #6f42c1;
    color: #fff;
}

.best-sellers-table {
    max-width: 100%;
    overflow-x: auto;
}

/* Band colours */
.tk-band-a {
  background-color: #6a0dad !important;
  border-color: #6a0dad !important;
  color: #fff !important;
}

.tk-band-b {
  background-color: #e91e63 !important;
  border-color: #e91e63 !important;
  color: #fff !important;
}

.tk-band-c {
  background-color: #795548 !important;
  border-color: #795548 !important;
  color: #fff !important;
}

.btn-band-inactive {
  font-weight: 500;
  padding-inline: 0.6rem;
}

.btn-band-active {
  font-weight: 600;
}
.tk-chip {
  cursor: grab;
  font-weight: 500;
}

.tk-chip:active {
  cursor: grabbing;
}

.bg-shop {
  background-color: #0d6efd !important;
  color: #fff !important;
}

.bg-concession {
  background-color: #6f42c1 !important;
  color: #fff !important;
}

.bg-ignored {
  background-color: #adb5bd !important;
  color: #212529 !important;
}