/* Patlon Interlocks brand theme - industrial blue/navy */
:root {
  --patlon-primary: #1565c0;
  --patlon-primary-600: #0d47a1;
  --patlon-dark: #0d3b66;
  --patlon-accent: #ff8f00;
  --sandy-primary: #1565c0;
  --sandy-primary-600: #0d47a1;
  --sandy-dark: #0d3b66;
  --sandy-muted: #5c6b7a;
  --sandy-bg: #f0f2f5;
  --sandy-border: #dfe3e8;
  --sandy-card-bg: #ffffff;
}

html, body { height: 100%; }
body {
  background: var(--sandy-bg);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #111827;
}
.navbar {
  position: sticky;
  top: 0;
  z-index: 1200; /* highest layer to keep user info above all menus */
  background: var(--patlon-dark);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.navbar .dropdown-menu {
  z-index: 1250; /* ensure dropdown overlays chip nav/breadcrumb */
}
.card { background: var(--sandy-card-bg); box-shadow: 0 1px 2px rgba(0,0,0,0.05); border-radius: .5rem; border: 1px solid var(--sandy-border); }
.card .card-title { font-weight: 600; }
.list-group-item.active { background-color: var(--sandy-primary); border-color: var(--sandy-primary); color: #fff; }
.list-group-item-action { padding: .75rem 1rem; }
.btn-primary { background-color: var(--sandy-primary); border-color: var(--sandy-primary); }
.btn-primary:hover { background-color: var(--sandy-primary-600); border-color: var(--sandy-primary-600); }
.min-vh-100 { min-height: 100vh; }
.login-card { max-width: 380px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-title { margin: 0; font-weight: 600; }
.page-actions .btn { margin-left: .5rem; }

/* Breadcrumb bar tweaks - currently hidden as per user request */
#breadcrumb-bar { 
  display: none !important;
  z-index: 950; 
  position: relative; 
  background: #fff; 
}

/* Tables */
.table thead th { font-weight: 600; color: var(--sandy-muted); background: #fafafa; }
.table td, .table th { vertical-align: middle; }

/* Toolbar */
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.toolbar .form-control, .toolbar .form-select { height: 36px; padding: .25rem .5rem; }

/* Dashboard cards */
.stat-card .label { color: var(--sandy-muted); font-size: .875rem; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; }
.stat-card .icon { color: var(--sandy-primary); opacity: .9; }

/* Form page layout */
.form-section { border: 1px solid var(--sandy-border); border-radius: .5rem; background: var(--sandy-card-bg); padding: 1rem; margin-bottom: 1rem; }
.form-section-title { font-weight: 600; color: var(--sandy-muted); margin-bottom: .75rem; text-transform: uppercase; letter-spacing: .02em; font-size: .8rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; }

/* Chip nav (top buttons like screenshot) */
.chip-nav { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; flex-wrap: wrap; position: relative; z-index: 900; }
.chip-nav .chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem; background: var(--patlon-primary); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: .5rem; text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; flex-shrink: 0; }
.chip-nav .chip:hover { background: var(--patlon-primary-600); color: #fff; }
.chip-nav .chip .bi { color: #0d3b66; background: rgba(255,255,255,.9); border-radius: .2rem; padding: .05rem .2rem; }
.chip-nav .spacer { flex: 1; }
.chip-nav .chip-logout { background: #dc3545; border-color: rgba(255,255,255,.6); }
.chip-nav .chip-logout:hover { background: #bb2d3b; }

/* Dropdown styling for chip nav */
.chip-nav .dropdown { position: relative; }
.chip-nav .dropdown-menu { 
  background: #fff; 
  border: 1px solid var(--sandy-border); 
  border-radius: .5rem; 
  box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
  position: absolute; 
  top: 100%; 
  left: 0; 
  z-index: 1050; 
  min-width: 200px;
  margin-top: .25rem;
}
.chip-nav .dropdown-item { padding: .5rem 1rem; color: #333; }
.chip-nav .dropdown-item:hover { background: var(--sandy-primary); color: #fff; }

/* Responsive navbar */
@media (max-width: 1200px) {
  .chip-nav .chip { font-size: .8rem; padding: .3rem .5rem; }
}

@media (max-width: 992px) {
  .chip-nav { gap: .3rem; padding: .4rem .5rem; }
  .chip-nav .chip { font-size: .75rem; padding: .25rem .4rem; }
  .chip-nav .chip .bi { padding: .03rem .15rem; }
}

/* Chart containers */
canvas {
  max-width: 100%;
  height: auto !important;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-container canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

/* Professional Footer Styling - Patlon theme */
footer {
  background: linear-gradient(135deg, var(--patlon-dark) 0%, #0a2540 100%);
  color: #ecf0f1;
  padding: 3rem 0 1rem;
  margin-top: auto;
  border-top: 3px solid var(--patlon-primary);
}

.footer-section {
  margin-bottom: 2rem;
}

.footer-title {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-text {
  color: #bdc3c7;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #bdc3c7;
  font-size: 0.9rem;
}

.contact-item i {
  color: var(--sandy-primary);
  font-size: 1rem;
  width: 16px;
  text-align: center;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: inline-block;
}

.footer-links a:hover {
  color: var(--sandy-primary);
  transform: translateX(5px);
}

.system-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.info-item .label {
  color: #95a5a6;
  font-weight: 500;
}

.info-item .value {
  color: #ecf0f1;
  font-weight: 600;
}

.status-online {
  color: #27ae60 !important;
  position: relative;
}

.status-online::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #27ae60;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.footer-bottom {
  border-top: 1px solid #34495e;
  padding-top: 1.5rem;
  margin-top: 2rem;
}

.copyright {
  color: #95a5a6;
  font-size: 0.85rem;
}

.footer-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.footer-badges .badge {
  background: rgba(21, 101, 192, 0.15);
  color: #90caf9;
  border: 1px solid rgba(21, 101, 192, 0.4);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

/* Responsive Footer */
@media (max-width: 992px) {
  footer {
    padding: 2rem 0 1rem;
  }
  
  .footer-section {
    margin-bottom: 1.5rem;
  }
  
  .footer-badges {
    justify-content: center;
    margin-top: 1rem;
  }
}

@media (max-width: 768px) {
  footer {
    padding: 1.5rem 0 1rem;
  }
  
  .footer-title {
    font-size: 0.9rem;
  }
  
  .footer-text {
    font-size: 0.85rem;
  }
  
  .contact-item,
  .footer-links a {
    font-size: 0.85rem;
  }
  
  .footer-badges {
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .footer-contact {
    gap: 0.5rem;
  }
  
  .contact-item {
    gap: 0.5rem;
  }
  
  .footer-badges {
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
  }
  
  .footer-badges .badge {
    font-size: 0.7rem;
  }
}

/* User Management Styles */
.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sandy-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.avatar-circle.bg-success { background: #28a745; }
.avatar-circle.bg-warning { background: #ffc107; color: #000; }
.avatar-circle.bg-danger { background: #dc3545; }
.avatar-circle.bg-info { background: #17a2b8; }
.avatar-circle.bg-primary { background: var(--sandy-primary); }

/* Enhanced Modal Styles */
.modal-xl {
  max-width: 1200px;
}

.modal-header {
  border-bottom: 2px solid var(--sandy-border);
  padding: 1rem 1.5rem;
}

.modal-footer {
  border-top: 2px solid var(--sandy-border);
  padding: 1rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

/* Permissions Table */
#permissionsTableBody tr:hover {
  background-color: #f8f9fa;
}

#permissionsTableBody td {
  padding: 0.75rem;
}

.permission-check,
.permission-all {
  cursor: pointer;
  width: 20px;
  height: 20px;
}

.permission-check:disabled,
.permission-all:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Badge Enhancements */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
  font-size: 0.75rem;
}

.badge.bg-primary { background-color: var(--sandy-primary) !important; }
.badge.bg-info { background-color: #17a2b8 !important; }
.badge.bg-warning { background-color: #ffc107 !important; color: #000 !important; }
.badge.bg-success { background-color: #28a745 !important; }

/* Button Group Enhancements */
.btn-group-sm .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-group-sm .btn i {
  font-size: 0.9rem;
}

/* Table Action Buttons */
.table td .btn-group {
  white-space: nowrap;
}

/* Form Enhancements */
.form-label .text-danger {
  margin-left: 2px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--sandy-primary);
  box-shadow: 0 0 0 0.2rem rgba(21, 101, 192, 0.25);
}

/* Statistics Cards Enhancements */
.stat-card .value.text-success { color: #28a745 !important; }
.stat-card .value.text-danger { color: #dc3545 !important; }
.stat-card .value.text-primary { color: var(--sandy-primary) !important; }

.stat-card .icon.text-success { color: #28a745 !important; }
.stat-card .icon.text-danger { color: #dc3545 !important; }
.stat-card .icon.text-primary { color: var(--sandy-primary) !important; }

/* Pagination */
.pagination .page-link {
  color: var(--sandy-primary);
  border-color: var(--sandy-border);
}

.pagination .page-link:hover {
  background-color: var(--sandy-primary);
  color: #fff;
  border-color: var(--sandy-primary);
}

.pagination .page-item.active .page-link {
  background-color: var(--sandy-primary);
  border-color: var(--sandy-primary);
}

/* Responsive Table */
@media (max-width: 768px) {
  .table-responsive {
    font-size: 0.875rem;
  }
  
  .btn-group-sm .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
  
  .avatar-circle {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
  
  .modal-xl {
    max-width: 100%;
  }
}

/* Alert Enhancements */
.alert-info {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.alert-info i {
  color: #17a2b8;
}

/* Toolbar Enhancements */
.toolbar input[type="text"] {
  min-width: 200px;
}

/* Loading States */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to { transform: rotate(360deg); }
}

/* Dashboard KPI Drill-Down Links */
.stat-card.kpi-link {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card.kpi-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.stat-card.kpi-link:active {
  transform: translateY(0);
}

