/* ============================================================
   MASTER THEME  -  Fixed Indigo admin by MASTER SIYAM
   Loaded last so it overrides AdminLTE / Bootstrap defaults.
   Goal: ONE consistent indigo accent everywhere, high
   readability, and a FIXED admin color that never depends on
   the client "site color" setting (so admin text never breaks).
   ============================================================ */

:root {
  --ms-bg: #f4f6fb;
  --ms-surface: #ffffff;
  --ms-border: #e6eaf0;
  --ms-text: #1f2937;
  --ms-muted: #6b7280;

  /* Fixed indigo accent (admin-only, independent of site color) */
  --ms-primary: #6366f1;
  --ms-primary-dark: #4f46e5;
  --ms-primary-darker: #4338ca;
  --ms-primary-soft: #eef2ff;
  --ms-primary-soft2: #e0e7ff;
  --ms-primary-ring: rgba(99, 102, 241, 0.3);

  /* Deep indigo sidebar */
  --ms-sidebar: #2e2a6e;
  --ms-sidebar-2: #1e1b4b;
  --ms-sidebar-text: #c7d2fe;
}

body,
.content-wrapper {
  background: var(--ms-bg);
  color: var(--ms-text);
}

.wrapper {
  background: var(--ms-bg);
}

/* Headings + general text readability */
h1, h2, h3, h4, h5, h6,
.content-header h1 {
  color: #111827;
}

.text-muted, small {
  color: var(--ms-muted);
}

a {
  color: var(--ms-primary);
}

a:hover {
  color: var(--ms-primary-dark);
}

/* Top navbar */
.main-header.navbar {
  background: var(--ms-surface);
  border-bottom: 1px solid var(--ms-border);
}

.main-header .nav-link {
  color: #374151;
}

/* Sidebar - deep indigo gradient */
.main-sidebar,
.sidebar-dark-primary {
  background: linear-gradient(180deg, var(--ms-sidebar) 0%, var(--ms-sidebar-2) 100%);
}

.brand-link {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.brand-link .brand-text {
  color: #ffffff;
  font-weight: 700;
}

.nav-sidebar .nav-link {
  color: var(--ms-sidebar-text);
  border-radius: 8px;
  margin: 2px 8px;
}

.nav-sidebar .nav-link p {
  color: var(--ms-sidebar-text);
}

.nav-sidebar .nav-link .nav-icon {
  color: #a5b4fc;
}

.nav-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-sidebar .nav-link:hover p,
.nav-sidebar .nav-link:hover .nav-icon {
  color: #ffffff;
}

.nav-sidebar .nav-link.active {
  background: var(--ms-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.45);
}

.nav-sidebar .nav-link.active p,
.nav-sidebar .nav-link.active .nav-icon {
  color: #ffffff;
}

.sidebar .user-panel .info a {
  color: #ffffff;
}

/* Cards */
.card {
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

.card-header {
  background: var(--ms-surface);
  border-bottom: 1px solid var(--ms-border);
  color: #111827;
  font-weight: 600;
}

.card-title {
  font-weight: 600;
}

/* Card accent header variants (AdminLTE card-primary etc.) */
.card-primary:not(.card-outline) > .card-header {
  background: var(--ms-primary);
  color: #ffffff;
}

/* Buttons */
.btn-primary,
.btn-success {
  background: var(--ms-primary);
  border-color: var(--ms-primary);
  color: #ffffff;
}

.btn-primary:hover,
.btn-success:hover {
  background: var(--ms-primary-dark);
  border-color: var(--ms-primary-dark);
}

.btn-secondary {
  background: #eef1f6;
  border-color: #e2e6ee;
  color: #374151;
}

/* Forms */
label {
  color: #374151;
  font-weight: 500;
}

.form-control,
.custom-select {
  background: #ffffff;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.form-control:focus {
  border-color: var(--ms-primary);
  box-shadow: 0 0 0 3px var(--ms-primary-ring);
}

.form-control::placeholder {
  color: #9ca3af;
}

/* Tables */
.table {
  color: var(--ms-text);
}

.table thead th {
  background: #f4f5ff;
  color: #3730a3;
  border-bottom: 2px solid var(--ms-border);
}

.table td,
.table th {
  border-top: 1px solid var(--ms-border);
}

.table-hover tbody tr:hover {
  background: #f5f6ff;
}

/* Info / small boxes keep colored bg but force readable white text */
.small-box {
  border-radius: 12px;
}

.small-box h3,
.small-box p,
.info-box .info-box-text,
.info-box .info-box-number {
  color: inherit;
}

/* Badges, alerts */
.badge-success,
.badge-primary {
  background: var(--ms-primary);
  color: #ffffff;
}

.alert-success {
  background: var(--ms-primary-soft);
  color: var(--ms-primary-darker);
  border-color: #c7d2fe;
}

/* Footer */
.main-footer {
  background: var(--ms-surface);
  color: var(--ms-muted);
  border-top: 1px solid var(--ms-border);
}

.main-footer a {
  color: var(--ms-primary);
}

/* ============================================================
   Readability hardening - keep all body text dark on light
   surfaces so nothing turns white-on-white.
   ============================================================ */
.content-wrapper,
.content-wrapper p,
.content-wrapper span,
.content-wrapper li,
.content-wrapper td,
.content-wrapper th,
.content-wrapper label,
.content-wrapper div,
.card-body,
.card-body p,
.card-body span,
.card-body li,
.content-header .breadcrumb-item,
.content-header .breadcrumb-item a {
  color: #1f2937;
}

/* Muted helper text stays readable but softer */
.content-wrapper .text-muted,
.card-body .text-muted,
.form-text {
  color: #6b7280;
}

/* Inputs and selects always dark text on white */
.content-wrapper input,
.content-wrapper select,
.content-wrapper textarea {
  color: #111827;
  background: #ffffff;
}

/* Links inside content keep the brand color, not white */
.content-wrapper a:not(.btn) {
  color: var(--ms-primary);
}

/* Buttons: clear, tappable, accessible focus ring */
.btn {
  border-radius: 8px;
  font-weight: 600;
  padding: 0.5rem 1rem;
  letter-spacing: 0.2px;
}

.btn:focus,
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ms-primary-ring);
}

.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.btn-info {
  background: var(--ms-primary-dark);
  border-color: var(--ms-primary-dark);
  color: #ffffff;
}

.btn-info:hover {
  background: var(--ms-primary-darker);
  border-color: var(--ms-primary-darker);
}

.btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1f2937;
}

.btn-outline-primary {
  color: var(--ms-primary);
  border-color: var(--ms-primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--ms-primary);
  color: #ffffff;
}

/* Make sure colored stat boxes keep white text for contrast */
.small-box,
.small-box h3,
.small-box p,
.small-box .icon,
.bg-info,
.bg-success,
.bg-primary,
.bg-danger,
.bg-warning {
  color: #ffffff;
}

.bg-primary,
.small-box.bg-primary,
.bg-info,
.small-box.bg-info,
.bg-success,
.small-box.bg-success {
  background-color: var(--ms-primary) !important;
}

.bg-warning,
.small-box.bg-warning,
.small-box.bg-warning h3,
.small-box.bg-warning p {
  color: #1f2937;
}

/* Dropdown menus readable */
.dropdown-menu {
  background: #ffffff;
  border: 1px solid var(--ms-border);
}

.dropdown-item {
  color: #1f2937;
}

.dropdown-item:hover {
  background: var(--ms-primary-soft);
  color: #111827;
}

/* Login page (admin) - indigo button + soft card */
.login-page,
.register-page {
  background: var(--ms-bg);
}

.login-logo a,
.register-logo a {
  color: var(--ms-primary-darker);
}

.login-card-body,
.register-card-body {
  border-radius: 12px;
}

/* ============================================================
   Dashboard stat cards (.outer-box)
   White card + soft indigo inner box + indigo text.
   One consistent accent, fully readable. Appended last.
   ============================================================ */
.outer-box {
  background: #ffffff !important;
  border: 1px solid #c7d2fe !important;
  border-radius: 0.6rem !important;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.1);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.outer-box:hover {
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.22);
  transform: translateY(-2px);
}
.outer-box .info-box {
  background: var(--ms-primary-soft) !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}
.outer-box .info-box .info-box-text {
  color: var(--ms-primary-darker) !important;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.outer-box .info-box .info-box-number {
  color: var(--ms-primary-dark) !important;
  font-weight: 800;
}
.outer-box .more-info {
  background: var(--ms-primary-soft2) !important;
  color: var(--ms-primary-darker) !important;
  font-weight: 600;
}
.outer-box .more-info i {
  color: var(--ms-primary-dark) !important;
}


/* ============================================================
   PHASE 1  -  Mobile drawer, brand/logo, responsive polish
   Appended last so it overrides AdminLTE + earlier custom CSS.
   (Fixes: sidebar toggle on mobile, logo display, colors.)
   ============================================================ */

/* Neutralize the old broken custom toggle classes */
.opensidebar { margin-left: 0 !important; }
.removesidebar { margin-left: 0 !important; }

/* Top-navbar hamburger button */
.ms-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-left: 6px;
  border-radius: 10px;
  color: #374151;
  font-size: 20px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.ms-menu-toggle:hover,
.ms-menu-toggle:focus {
  background: var(--ms-primary-soft);
  color: var(--ms-primary-dark);
  outline: none;
}

/* Brand / logo area - single clean lockup */
.main-sidebar .brand-link.ms-brand {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  min-height: 57px;
  white-space: nowrap;
  overflow: hidden;
}
.main-sidebar .brand-link.ms-brand .brand-image {
  height: 38px;
  width: 38px;
  margin: 0 !important;
  opacity: 1 !important;
  background: #fff;
  object-fit: cover;
  border: 0;
  flex: 0 0 auto;
}
.main-sidebar .brand-link.ms-brand .brand-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #ffffff;
  margin: 0;
}
.ms-sidebar-close {
  display: none;
  margin-left: auto;
  font-size: 22px;
  line-height: 1;
  color: #c7d2fe;
  cursor: pointer;
  padding: 4px 6px;
}
.ms-sidebar-close:hover { color: #ffffff; }

/* Backdrop hidden by default (desktop) */
.ms-sidebar-backdrop { display: none; }

/* ---------------- Mobile (<= 991.98px) ---------------- */
@media (max-width: 991.98px) {
  .main-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    margin-left: -260px !important;
    transition: margin-left 0.3s ease-in-out !important;
    z-index: 1045 !important;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.28);
  }
  body.ms-sidebar-open .main-sidebar { margin-left: 0 !important; }

  .content-wrapper,
  .main-header,
  .main-footer { margin-left: 0 !important; }

  .ms-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
  }
  body.ms-sidebar-open .ms-sidebar-backdrop { opacity: 1; visibility: visible; }
  body.ms-sidebar-open { overflow: hidden; }

  .ms-sidebar-close { display: block; }
}

/* ---------------- Desktop (>= 992px) ---------------- */
@media (min-width: 992px) {
  .ms-sidebar-close { display: none !important; }
  .ms-sidebar-backdrop { display: none !important; }
}


/* ============================================================
   PHASE 3  -  Table & Form page polish (all list/create/edit
   pages: Product, Package, Order, Banner, Users, etc.)
   CSS-only; no markup or data-binding changes.
   ============================================================ */

/* ---- Page header / breadcrumb ---- */
.content-header h1 { font-size: 22px; font-weight: 700; color: var(--ms-text); }
.content-header .breadcrumb { background: transparent; padding: 0; margin: 0; }
.breadcrumb-item a { color: var(--ms-primary-dark); text-decoration: none; }
.breadcrumb-item.active { color: var(--ms-muted); }

/* ---- Toolbar row above tables (Add + Search) ---- */
.wl-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.wl-p { padding: 0 4px 14px 4px; }
.input-search { min-width: 200px; color: #111827; }

/* ---- Cards ---- */
.card {
  border: 1px solid var(--ms-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.05);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--ms-border);
  border-radius: 14px 14px 0 0;
  font-weight: 600;
  color: var(--ms-text);
}

/* ---- Tables ---- */
.content .table-responsive,
.content-wrapper .table-responsive {
  background: #fff;
  border: 1px solid var(--ms-border);
  border-radius: 14px;
  padding: 6px 10px 10px 10px;
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.05);
}
.table { color: var(--ms-text); margin-bottom: 0; }
.table thead th {
  background: var(--ms-primary-soft);
  color: var(--ms-primary-darker);
  border: 0 !important;
  border-bottom: 2px solid var(--ms-primary-soft2) !important;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 12px;
  white-space: nowrap;
  vertical-align: middle;
}
.table tbody td {
  border-top: 1px solid #eef0f6 !important;
  padding: 11px 12px;
  vertical-align: middle;
  font-size: 14px;
}
.table.is-striped tbody tr:nth-of-type(odd),
.table-striped tbody tr:nth-of-type(odd) { background: #fafbff; }
.table.is-hoverable tbody tr:hover,
.table-hover tbody tr:hover { background: var(--ms-primary-soft); }
.table img { border-radius: 8px; object-fit: cover; }

/* ---- Forms ---- */
.form-control,
.custom-select,
.content-wrapper textarea,
.content-wrapper select {
  border: 1px solid #d7dbe7;
  border-radius: 10px;
  color: var(--ms-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus,
.custom-select:focus,
.content-wrapper textarea:focus,
.content-wrapper select:focus {
  border-color: var(--ms-primary);
  box-shadow: 0 0 0 3px var(--ms-primary-ring);
  outline: none;
}
.content-wrapper label { font-weight: 600; color: #374151; }
.form-control-sm { border-radius: 8px; }

/* ---- Buttons ---- */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--ms-primary); border-color: var(--ms-primary); }
.btn-primary:hover,
.btn-primary:focus { background: var(--ms-primary-dark); border-color: var(--ms-primary-dark); }
.btn-success { background: #10b981; border-color: #10b981; }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-danger { background: #ef4444; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }
.btn-group .btn { margin-right: 4px; }

/* ---- Badges ---- */
.badge { border-radius: 8px; padding: 0.4em 0.65em; font-weight: 600; }

/* ---- Modals ---- */
.modal-content {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}
.modal-header { border-bottom: 1px solid var(--ms-border); }
.modal-footer { border-top: 1px solid var(--ms-border); }
/* Fix: "Code" label was aliceblue (invisible on white) in the stock modal */
.modal-body p { color: var(--ms-text) !important; }
.modal-body textarea {
  width: 100%;
  border: 1px solid #d7dbe7;
  border-radius: 10px;
  padding: 8px 10px;
}

/* ---- Pagination ---- */
.pagination .page-link {
  color: var(--ms-primary-dark);
  border: 1px solid var(--ms-border);
  border-radius: 8px;
  margin: 0 2px;
}
.pagination .page-item.active .page-link {
  background: var(--ms-primary);
  border-color: var(--ms-primary);
  color: #fff;
}


/* ============================================================
   PHASE 4  -  Login page + responsive safeguards + final QA
   ============================================================ */

/* ---- Login page ---- */
.login-page {
  background: linear-gradient(135deg, var(--ms-primary-soft) 0%, var(--ms-bg) 60%);
  min-height: 100vh;
}
.login-box { width: 400px; max-width: 94%; }
.login-logo .ms-login-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.4px;
  color: var(--ms-primary-darker);
  text-decoration: none;
}
.login-logo .ms-login-brand img {
  height: 46px;
  width: 46px;
  border-radius: 12px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
  object-fit: cover;
}
.login-page .card {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}
.login-card-body { border-radius: 16px; padding: 26px 26px 30px; }
.login-box-msg { color: var(--ms-muted); font-weight: 600; }
.login-page .input-group-text {
  background: var(--ms-primary-soft);
  border: 1px solid #d7dbe7;
  color: var(--ms-primary-dark);
  border-radius: 0 10px 10px 0;
}
.login-page .form-control { border-radius: 10px 0 0 10px; }
.login-page .btn-primary.btn-block {
  border-radius: 10px;
  padding: 9px 0;
  font-weight: 700;
}
/* Make the Sign In button full width regardless of the col-4 wrapper */
.login-page .row > .col-4 { flex: 0 0 100%; max-width: 100%; }

/* ---- Responsive safeguards / final QA ---- */
@media (max-width: 575.98px) {
  .content-header h1 { font-size: 19px; }
  .content-header .breadcrumb { float: none !important; margin-top: 4px; }
  .wl-flex { flex-direction: column; align-items: stretch; }
  .wl-flex form .mx-auto { flex-wrap: wrap; gap: 8px; }
  .input-search { min-width: 0; width: 100%; }
  .outer-box .info-box-number { font-size: 20px; }
  .main-footer { text-align: center; }
  .main-footer .float-right { float: none !important; display: block; }
}
/* Prevent wide tables from breaking layout on any screen */
.content .table-responsive,
.content-wrapper .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Modal fits small screens */
@media (max-width: 575.98px) {
  .modal-dialog { margin: 12px; }
}
/* User menu dropdown stays readable on mobile */
.navbar .user-menu .dropdown-menu { min-width: 230px; }

/* ===== PHASE 5 — combo items table ===== */
.combo-table{width:auto;min-width:60%;background:var(--ms-surface);border:1px solid var(--ms-border);border-radius:12px;overflow:hidden;box-shadow:0 1px 3px rgba(16,24,40,.06);}
.combo-table tr:first-child td{background:var(--ms-primary);color:#fff;font-weight:600;border:none;}
.combo-table td{padding:12px 16px;border-bottom:1px solid var(--ms-border);color:var(--ms-text);vertical-align:middle;}
.combo-table tr:last-child td{border-bottom:none;}
.combo-table tr:not(:first-child):hover td{background:var(--ms-primary-soft);}
