/* 
 * Custom Styles for Portal ISP 
 * Modern, Mobile-First, Responsive Layout
 */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Syne:wght@500;600;700;800&display=swap');

:root {
  /* Brand Colors */
  --brand: #2a2d96;
  --brand2: #3a3eb8;
  --brand-deep: #1e2070;
  --accent: #ff7502;
  --accent2: #e56600;

  /* UI Surface Colors */
  --bg: #eef0f8;
  --surface: #ffffff;
  --surface2: #f5f6fc;
  --raise: #eceefa;
  --line: #e3e6f4;
  --line2: #d4d8ec;

  /* Text Colors */
  --text: #191b3a;
  --text2: #5b6088;
  --text3: #9aa0c2;

  /* Status Colors */
  --green: #12b76a;
  --yellow: #f5a623;
  --red: #e5484d;
  --blue: #3a7afe;
  --purple: #7c5cff;
  --wa: #25d366;

  /* Dimensions */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 76px;
  --header-height: 70px;
  --transition-speed: 0.3s;
}

/* Base Styles */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

code,
.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cdd2e8;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b5bbdc;
}

/* --- Layout Structure (Mobile First) --- */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar (Mobile: Off-screen drawer) */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transform: translateX(-100%);
  transition: transform var(--transition-speed) ease;
  box-shadow: none;
}

.sidebar.show {
  transform: translateX(0);
}

/* Main Area (Mobile: Full width) */
.main-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  transition: padding-left var(--transition-speed) ease;
}

/* Header Navbar */
.header-navbar {
  height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0 1.5rem;
}

.content-body {
  padding: 1.5rem;
  flex: 1;
}

/* Backdrop for mobile when sidebar is open */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(25, 27, 58, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1030;
  display: none;
}

.sidebar-backdrop.show {
  display: block;
}

/* --- Sidebar Typography & Navigation --- */
.sidebar-brand-wrapper {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--brand);
  line-height: 1.2;
}

.sidebar-brand-subtitle {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 1px;
}

.sidebar-header-card {
  margin: 14px 16px 6px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  border-radius: 11px;
  box-shadow: none;
  color: #fff;
  transition: opacity 0.2s ease, max-height 0.2s ease, padding 0.2s ease;
  overflow: hidden;
}

.nav-section-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text3);
  text-transform: uppercase;
  padding: 12px 8px 6px;
  transition: opacity 0.2s ease;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text2);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
  margin-bottom: 2px;
}

.nav-item-link:hover {
  background-color: var(--surface2);
  color: var(--text);
}

.nav-item-link.active {
  background-color: var(--surface2);
  color: var(--brand);
  font-weight: 700;
  border-left-color: var(--brand);
}

.nav-item-link .badge-count {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  color: #fff;
}

.sidebar-user-footer {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 12px 4px 4px;
  padding: 11px 12px;
  border-radius: 11px;
  background-color: var(--surface2);
  border: 1px solid var(--line);
  transition: padding 0.2s ease;
}

.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

/* --- Layout adjustments for Larger Screens (Desktop) --- */
@media (min-width: 992px) {

  /* Sidebar is persistent and shown on desktop */
  .sidebar {
    transform: translateX(0);
    box-shadow: none;
  }

  .main-wrapper {
    padding-left: var(--sidebar-width);
  }

  /* Retractable Sidebar Behavior on Desktop */
  .sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar.collapsed .sidebar-brand-wrapper .brand-logo-full,
  .sidebar.collapsed .sidebar-header-card,
  .sidebar.collapsed .nav-section-title,
  .sidebar.collapsed .nav-item-link span:not(.badge-count),
  .sidebar.collapsed .sidebar-user-footer .user-details-text {
    display: none !important;
  }

  .sidebar.collapsed .sidebar-brand-wrapper {
    padding: 18px 10px;
    justify-content: center;
    display: flex;
  }

  .sidebar.collapsed .sidebar-nav {
    padding: 8px 8px 16px;
  }

  .sidebar.collapsed .nav-item-link {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
    position: relative;
  }

  .sidebar.collapsed .nav-item-link .badge-count {
    position: absolute;
    top: 2px;
    right: 6px;
    margin-left: 0;
    padding: 1px 5px;
    font-size: 9px;
  }

  .sidebar.collapsed .sidebar-user-footer {
    justify-content: center;
    padding: 11px 0;
    border: none;
    background: transparent;
  }

  /* Adjust Main Wrapper when sidebar is collapsed */
  .app-container.sidebar-is-collapsed .main-wrapper {
    padding-left: var(--sidebar-collapsed-width);
  }
}

/* --- Pulses & Animations --- */
.pulse-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--green);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.4);
  animation: pulse-green-anim 2s infinite;
}

@keyframes pulse-green-anim {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(18, 183, 106, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(18, 183, 106, 0);
  }
}

.blink-anim {
  animation: blink 1.6s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

/* --- Custom Cards & Aesthetic details --- */
.card-premium {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-premium-interactive:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: none;
}

.card-premium-accent:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: none;
}

.card-premium-red:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: none;
}

.card-premium-purple:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: none;
}

.card-premium-green:hover {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: none;
}

.card-premium-blue:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: none;
}

/* Custom Table & Grid Design */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.col-12 {
  grid-column: span 12;
}

.col-6 {
  grid-column: span 6;
}

@media (max-width: 991.98px) {
  .col-6 {
    grid-column: span 12;
  }
}

.table {
  width: 100% !important;
  table-layout: fixed;
}

.table th,
.table td,
.table-premium th,
.table-premium td {
  padding: 12px 14px !important;
  font-size: 13px;
  vertical-align: middle;
}

.table td:not(:last-child) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.table th:last-child,
.table td:last-child {
  white-space: nowrap !important;
  overflow: visible !important;
}

.table th,
.table-premium th {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Syne', sans-serif;
  border-bottom: 1px solid var(--line);
}

/* Modal styling */
.modal-content-premium {
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: none;
  background-color: var(--surface);
}

.form-control-premium {
  background-color: var(--surface2);
  border: 1px solid var(--line2);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control-premium:focus {
  border-color: var(--brand);
  background-color: var(--surface);
  box-shadow: none;
  color: var(--text);
}

/* Tabs Toggle Button Group */
.toggle-btn-group {
  display: flex;
  gap: 4px;
  background-color: var(--surface);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 11px;
  box-shadow: none;
}

.toggle-btn {
  padding: 7px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn.active {
  background-color: var(--brand);
  color: #fff;
}

/* Alert Boxes */
.alert-box {
  display: flex;
  gap: 11px;
  padding: 11px;
  border-radius: 10px;
  font-size: 13px;
}

.alert-box-orange {
  background-color: rgba(255, 117, 2, 0.06);
  border: 1px solid rgba(255, 117, 2, 0.2);
}

.alert-box-yellow {
  background-color: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.24);
}

.alert-box-green {
  background-color: rgba(18, 183, 106, 0.07);
  border: 1px solid rgba(18, 183, 106, 0.22);
}

.alert-box-red {
  background-color: rgba(229, 72, 77, 0.07);
  border: 1px solid rgba(229, 72, 77, 0.22);
}

/* Map Node Markers styling */
.pop-map-container {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  background-image: none;
}

.map-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
}

.node-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  transition: transform 0.2s ease;
}

.node-marker:hover {
  transform: scale(1.15);
}

.node-marker-ok {
  background-color: rgba(18, 183, 106, 0.1);
  border: 2px solid var(--green);
}

.node-marker-ok::after {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--green);
}

.node-marker-degraded {
  background-color: rgba(245, 166, 35, 0.14);
  border: 2px solid var(--yellow);
  color: #c98a18;
  font-size: 11px;
}

.node-marker-intl {
  background-color: rgba(58, 122, 254, 0.1);
  border: 2px solid var(--blue);
}

.node-marker-intl::after {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--blue);
}

.node-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text2);
  font-weight: 600;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* Switch toggle styling */
.switch-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
  background-color: var(--line2);
  flex-shrink: 0;
}

.switch-track.active {
  background-color: var(--wa);
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: none;
  transition: transform 0.2s ease;
}

.switch-track.active .switch-knob {
  transform: translateX(16px);
}

/* Toast styling */
.toast-premium {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1080;
  background-color: var(--surface);
  border: 1px solid rgba(37, 211, 102, 0.4);
  border-left: 4px solid var(--wa);
  border-radius: 11px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  box-shadow: none;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast-premium.show {
  transform: translateY(0);
  opacity: 1;
}

/* Toast Icon */
.toast-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--wa);
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

/* Chart Canvas Wrapper */
.chart-container {
  position: relative;
  width: 100%;
}

/* Responsive SVG Chart Typography - Enlarge text elements on Mobile & Tablet devices */
@media (max-width: 991.98px) {
  svg text {
    font-size: 12.5px !important;
  }

  svg text[font-weight="600"],
  svg text[font-weight="bold"] {
    font-size: 13.5px !important;
  }
}

@media (max-width: 575.98px) {
  svg text {
    font-size: 13.5px !important;
    stroke-width: 3.5px !important;
  }

  svg text[font-weight="600"],
  svg text[font-weight="bold"] {
    font-size: 14.5px !important;
    stroke-width: 3.5px !important;
  }
}

/* ============ Desktop Topbar & Sidebar Brand Alignment ============ */
@media (min-width: 992px) {
  .d-sidebar {
    padding-top: 0 !important;
    gap: 14px !important;
  }

  .d-topbar {
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-sizing: border-box !important;
  }

  .d-sidebar .brand {
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    padding: 0 16px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35) !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }
}