/* Override container-xxl max-width for wider displays */
@media (min-width: 1400px) {
    .container-xxl {
        max-width: 1600px;
    }
}

/* SIM Card Status Badges - Bootstrap doesn't have these specific colors */

/* Status badge base style */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* In Use - Blue badge */
.status-in-use,
.badge-status-in-use {
    background-color: #cce5ff !important;
    color: #004085 !important;
}

/* Stock - Green badge */
.status-stock,
.badge-status-stock {
    background-color: #d4edda !important;
    color: #155724 !important;
}

/* Lost - Red badge */
.status-lost,
.badge-status-lost {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

/* Recalled - Yellow badge */
.status-recalled,
.badge-status-recalled {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

/* Terminated - Gray badge */
.status-terminated,
.badge-status-terminated {
    background-color: #d6d8d9 !important;
    color: #1b1e21 !important;
}

/* Unknown - Light gray badge */
.status-unknown,
.badge-status-unknown {
    background-color: #e2e3e5 !important;
    color: #383d41 !important;
}

/* SIM Card Operator Badges */

/* Operator badge base style */
.operator-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* CMHK - Light blue */
.operator-cmhk {
    background-color: #cce5ff !important;
    color: #004085 !important;
}

/* SMT - Light red */
.operator-smt {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

/* 3HK - Light purple */
.operator-3hk {
    background-color: #e2d4f0 !important;
    color: #563d7c !important;
}

/* HGC - Muted light red with darker shade */
.operator-hgc {
    background-color: #f5c6cb !important;
    color: #5a1f25 !important;
}

/* CSL - Light orange-yellow */
.operator-csl {
    background-color: #ffeeba !important;
    color: #856404 !important;
}

/* GC - Light yellow */
.operator-gc {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

/* PCCW - Light green */
.operator-pccw {
    background-color: #d4edda !important;
    color: #155724 !important;
}

/* Cable - Secondary gray */
.operator-cable {
    background-color: #e2e3e5 !important;
    color: #383d41 !important;
}

/* Client - Light cyan */
.operator-client {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
}

/* OTHER - Bootstrap secondary */
.operator-other {
    background-color: #e2e3e5 !important;
    color: #383d41 !important;
}

/* Default/Unknown - Same as secondary */
.operator-default {
    background-color: #e2e3e5 !important;
    color: #383d41 !important;
}

/* Legacy status classes (for backward compatibility) */
.status-available {
    background-color: #d4edda !important;
    color: #155724 !important;
}

.status-in_use {
    background-color: #cce5ff !important;
    color: #004085 !important;
}

.status-suspended {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

.status-expired {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

/* Toast notification styling */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 9999;
    display: none;
}

.toast.toast-success {
    background-color: #28a745;
}

.toast.toast-error {
    background-color: #dc3545;
}

.toast.toast-info {
    background-color: #17a2b8;
}

/* Page title styling if Bootstrap h1/h2 doesn't match */
.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #212529;
}

/* SIM Table Column Sizing - Flexbox with Min-Width */
#sims-table {
    table-layout: auto;
    min-width: 100%;
}

#sims-table th,
#sims-table td {
    white-space: nowrap;
    vertical-align: middle;
}

/* Fixed-width columns - badges, buttons, IP addresses */
#sims-table th:nth-child(1),  /* ICCID */
#sims-table th:nth-child(5),  /* Data Plan */
#sims-table th:nth-child(8) { /* Device Name */
    min-width: 130px;
}

#sims-table th:nth-child(2),  /* Phone Number */
#sims-table th:nth-child(6),  /* IP */
#sims-table th:nth-child(7) { /* Project Code */
    min-width: 110px;
}

#sims-table th:nth-child(3),  /* Status */
#sims-table th:nth-child(4) { /* Operator */
    min-width: 90px;
}

#sims-table th:nth-child(9) {  /* Actions */
    min-width: 140px;
    text-align: center;
}

#sims-table td:last-child {
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    #sims-table th:nth-child(5),  /* Data Plan */
    #sims-table th:nth-child(8) { /* Device Name */
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    #sims-table th,
    #sims-table td {
        min-width: 80px;
    }
}

/* Status Cards - Prevent text wrapping to fit 6 cards in one row */
.status-card {
    min-width: 0;
}

.status-card .card-body {
    padding: 0.5rem;
}

.status-card .card-label {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.status-card .display-6 {
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
}

/* User Dropdown Styles */
.navbar .user-dropdown-toggle {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  transition: background-color 0.15s ease-in-out;
}

.navbar .user-dropdown-toggle:hover,
.navbar .user-dropdown-toggle:focus {
  background-color: rgba(0, 0, 0, 0.05);
}

.navbar .dropdown-menu {
  min-width: 14rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.navbar .dropdown-item {
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
}

.navbar .dropdown-item i {
  font-size: 1.125rem;
  width: 1.5rem;
  opacity: 0.6;
}

.navbar .dropdown-item:hover i {
  opacity: 1;
}

.navbar .user-email {
  font-size: 0.875rem;
  font-weight: 500;
}

.navbar .user-greeting {
  font-size: 0.75rem;
  line-height: 1;
  opacity: 0.6;
}

/* Mobile adjustments */
@media (max-width: 991.98px) {
  .navbar .user-dropdown {
    margin-top: 0.5rem;
  }
}

/* IP Address Link Styling */
.ip-link {
    color: #0d6efd;
    text-decoration: none;
    cursor: pointer;
}

.ip-link:hover {
    text-decoration: underline;
    color: #0a58ca;
}

/* ========================================
   STICKY COLUMNS FOR SIM TABLE
   Simple, standard implementation
   ======================================== */

/* First sticky column - always at left: 0 */
#sims-table th.sticky-left,
#sims-table td.sticky-left {
    position: sticky;
    left: 0;
    background-color: #fff;
    z-index: 10;
    box-shadow: inset -2px 0 0 #dee2e6;
}

#sims-table thead th.sticky-left {
    z-index: 20;
}

/* Second sticky column - positioned via JavaScript */
#sims-table th.sticky-left-2,
#sims-table td.sticky-left-2 {
    position: sticky;
    background-color: #fff;
    z-index: 9;
    box-shadow: inset -2px 0 0 #dee2e6;
}

#sims-table thead th.sticky-left-2 {
    z-index: 19;
}

/* Checkbox column for batch mode */
#sims-table th.sticky-checkbox,
#sims-table td.sticky-checkbox {
    position: sticky;
    left: 0;
    background-color: #f8f9fa;
    z-index: 11;
    width: 1%;  /* Changed from 40px - shrink to fit */
    min-width: 0;  /* Allow shrinking */
    white-space: nowrap;  /* Prevent wrapping */
    text-align: center;
    box-shadow: inset -2px 0 0 #dee2e6;
}

#sims-table thead th.sticky-checkbox {
    z-index: 21;
}

/* ========================================
   FILTER DROPDOWN BUTTON STYLES
   Handle long labels (Billing Account, Contract Number)
   ======================================== */

/* Filter dropdown button container */
#status-filter-container .btn-group.dropdown,
#operator-filter-container .btn-group.dropdown,
#project-filter-container .btn-group.dropdown,
#data-plan-filter-container .btn-group.dropdown,
#billing-account-filter-container .btn-group.dropdown,
#invoice-number-filter-container .btn-group.dropdown {
    width: 100%;
}

/* Filter dropdown buttons - match form-control height */
#status-filter-btn,
#operator-filter-btn,
#project-filter-btn,
#data-plan-filter-btn,
#billing-account-filter-btn,
#invoice-number-filter-btn {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    /* Match Bootstrap form-control height (38px) */
    height: 38px;
    line-height: 1.5;
    vertical-align: middle;
    display: flex;
    align-items: center;
}

/* Ensure dropdown menu matches button width exactly */
#status-filter-menu,
#operator-filter-menu,
#project-filter-menu,
#data-plan-filter-menu,
#billing-account-filter-menu,
#invoice-number-filter-menu {
    min-width: 100%;
    width: 100%;
}

/* Dropdown menu items - prevent wrapping */
#status-filter-menu .dropdown-item,
#operator-filter-menu .dropdown-item,
#project-filter-menu .dropdown-item,
#data-plan-filter-menu .dropdown-item,
#billing-account-filter-menu .dropdown-item,
#invoice-number-filter-menu .dropdown-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
