/* ═══════════════════════════════════════════════════════════════
   SPS Helper — Global Styles
   ═══════════════════════════════════════════════════════════════ */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --sidebar-bg: #1B2A3B;
  --sidebar-hover: #243547;
  --sidebar-active: #1565C0;
  --sidebar-text: #A8BCCF;
  --sidebar-text-bright: #E8F0FE;
  --sidebar-border: rgba(255,255,255,0.07);

  --topbar-height: 56px;
  --topbar-bg: #FFFFFF;
  --topbar-border: #E2E8F0;

  --body-bg: #F1F5F9;
  --card-bg: #FFFFFF;
  --card-border: #E2E8F0;
  --card-radius: 12px;
  --card-shadow: 0 1px 4px rgba(0,0,0,0.08);

  --accent: #1565C0;
  --accent-light: #E3F2FD;
  --text-primary: #1A202C;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;

  --transition: 0.22s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: 'Segoe UI', Arial, sans-serif; background: var(--body-bg); color: var(--text-primary); }
a { text-decoration: none; color: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.sps-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  transition: width var(--transition);
  z-index: 1000;
  overflow: hidden;
}
.sps-sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0; white-space: nowrap;
}
.sidebar-brand-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--accent); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.sidebar-brand-text {
  flex: 1; font-size: 17px; color: var(--sidebar-text-bright);
  overflow: hidden; white-space: nowrap;
  transition: opacity var(--transition);
}
.sps-sidebar.collapsed .sidebar-brand-text { opacity: 0; pointer-events: none; }

.sidebar-toggle-btn {
  background: none; border: none; color: var(--sidebar-text);
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
  font-size: 13px; flex-shrink: 0;
  transition: color var(--transition);
}
.sidebar-toggle-btn:hover { color: var(--sidebar-text-bright); }
.sps-sidebar.collapsed .sidebar-toggle-btn i { transform: rotate(180deg); }

/* Nav */
.sidebar-nav {
  list-style: none; margin: 0; padding: 10px 0;
  overflow-y: auto; overflow-x: hidden; flex: 1;
}
.nav-item { margin: 1px 0; }

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  color: var(--sidebar-text);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap; cursor: pointer;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-bright); }
.nav-link.active { background: var(--accent); color: #fff; }

.nav-icon { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-text { flex: 1; font-size: 14px; transition: opacity var(--transition); white-space: nowrap; overflow: hidden; }
.nav-arrow { font-size: 11px; transition: transform var(--transition); flex-shrink: 0; }

.sps-sidebar.collapsed .nav-text,
.sps-sidebar.collapsed .nav-arrow { opacity: 0; width: 0; overflow: hidden; }

/* Submenu */
.nav-group.open > .nav-group-toggle .nav-arrow { transform: rotate(180deg); }
.nav-sub {
  list-style: none; padding: 0; margin: 0;
  max-height: 0; overflow: hidden;
  transition: max-height 0.28s ease;
  background: rgba(0,0,0,0.15);
}
.nav-group.open .nav-sub { max-height: 500px; }
.sps-sidebar.collapsed .nav-sub { display: none; }

.nav-sub-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 48px;
  color: var(--sidebar-text); font-size: 13px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-sub-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-bright); }
.nav-sub-link.active { color: #90CAF9; }
.sub-icon { font-size: 12px; width: 14px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-version { font-size: 11px; color: var(--sidebar-text); opacity: 0.45; white-space: nowrap; }
.sps-sidebar.collapsed .sidebar-version { opacity: 0; }

/* ═══════════════════════════════════════════════════════════════
   MAIN WRAPPER
   ═══════════════════════════════════════════════════════════════ */
.sps-main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left var(--transition);
}
.sps-sidebar.collapsed ~ .sps-main-wrapper { margin-left: var(--sidebar-collapsed-width); }

/* Topbar */
.sps-topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.topbar-menu-btn {
  background: none; border: none; font-size: 18px;
  color: var(--text-secondary); cursor: pointer; padding: 4px 8px;
}
.topbar-breadcrumb { flex: 1; }
.breadcrumb { font-size: 13px; }
.breadcrumb-item a { color: var(--accent); }
.breadcrumb-item.active { color: var(--text-secondary); }

.topbar-right { display: flex; align-items: center; }
.topbar-clock { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Content */
.sps-content { flex: 1; padding: 28px; }

/* Footer */
.sps-footer {
  padding: 12px 28px; font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--card-border);
  background: var(--topbar-bg);
}

/* Mobile overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 999;
}
.sidebar-overlay.visible { display: block; }

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════ */
.page-header { border-bottom: 1px solid var(--card-border); padding-bottom: 16px; }
.page-title { font-size: 1.55rem; font-weight: 700; color: var(--text-primary); margin: 0 0 4px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin: 0; }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD TILES
   ═══════════════════════════════════════════════════════════════ */
.tile-section-title {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-muted); margin-bottom: 16px;
}
.tile-section-line {
  width: 28px; height: 2px;
  background: var(--accent); border-radius: 2px; flex-shrink: 0;
}

.tile-card {
  display: flex; flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-top: 3px solid var(--tile-color, #1565C0);
  border-radius: var(--card-radius);
  padding: 20px; height: 100%;
  box-shadow: var(--card-shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.tile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.11);
}

.tile-icon-wrap {
  width: 44px; height: 44px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.tile-icon { font-size: 20px; color: var(--tile-color, #1565C0); }

.tile-body { flex: 1; }
.tile-title {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.tile-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  background: #F59E0B; color: #fff;
  padding: 2px 6px; border-radius: 4px;
}
.tile-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.55; }

.tile-arrow {
  margin-top: 14px; align-self: flex-end;
  color: var(--tile-color, #1565C0); font-size: 14px;
  transition: transform 0.15s;
}
.tile-card:hover .tile-arrow { transform: translateX(4px); }

.tile-placeholder {
  border: 1px dashed var(--card-border) !important;
  border-top: 1px dashed var(--card-border) !important;
  opacity: 0.5; cursor: default; pointer-events: none;
}
.tile-placeholder .tile-icon-wrap { background: #F1F5F9; }
.tile-placeholder .tile-icon { color: #94A3B8; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  .sps-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
    width: var(--sidebar-width) !important;
  }
  .sps-sidebar.mobile-open { transform: translateX(0); }
  .sps-main-wrapper { margin-left: 0 !important; }
  .sps-content { padding: 20px 16px; }
}
