* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: #0f172a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  margin: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.1) 1px,
    transparent 1px
  );
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #a5b4fc, #6366f1);
  z-index: 10;
}
.container {
  width: 100%;
  max-width: 1400px;

  background-image: url("../assets/bg.png");
  background-size: cover;
  background-position: center;

  background-color: #1e293b;

  border-radius: 1.5rem;

  padding: 2rem;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}

/* =====================================================
   FORM
===================================================== */

input[type="text"],
input[type="number"],
select {
  outline: none;
}

input:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

select option {
  background: #1e293b;
  color: #e2e8f0;
}

/* =====================================================
   LOGIN PAGE
===================================================== */

#landingPage {
  background: #1e293b;
  border: 1px solid rgba(99, 102, 241, 0.12);

  width: 100%;
  max-width: 420px;

  padding: 2.5rem;

  border-radius: 1.25rem;

  position: relative;

  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

#landingPage::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;

  width: 36px;
  height: 36px;

  border-top: 2px solid #6366f1;
  border-left: 2px solid #6366f1;

  border-radius: 1.25rem 0 0 0;
}

#landingPage::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;

  width: 36px;
  height: 36px;

  border-bottom: 2px solid #6366f1;
  border-right: 2px solid #6366f1;

  border-radius: 0 0 1.25rem 0;
}

#landingPage h1 {
  color: #e2e8f0;
  margin-bottom: 0.5rem;
}

#landingPage h1::after {
  content: "";
  display: block;

  width: 48px;
  height: 2px;

  margin-top: 0.75rem;

  background: #6366f1;
}

#landingPage > p {
  margin-bottom: 1.5rem;
  color: #94a3b8;
}

.error-message {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);

  color: #fb7185;

  padding: 0.75rem 1rem;
  border-radius: 0.75rem;

  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* =====================================================
   DASHBOARD
===================================================== */

#grafanaDashboardContainer {
  display: flex;
  flex-direction: column;

  width: 100%;
  height: 100%;

  flex: 1;

  min-height: 0;

  gap: 1rem;
}

/* =====================================================
   HEADER
===================================================== */

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  flex-wrap: wrap;
  gap: 1rem;

  flex-shrink: 0;
}

.dashboard-header h1 {
  color: #e2e8f0;
  font-size: 1.25rem;
  font-weight: 700;
}

.time-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.time-filter-wrapper label {
  color: #94a3b8;
  font-size: 0.875rem;
}

/* =====================================================
   IFRAME
===================================================== */

.grafana-iframe-wrapper {
  position: relative;

  flex: 1;

  min-height: 500px;

  width: 100%;

  overflow: hidden;

  border-radius: 1rem;

  background: #1e293b;

  border: 1px solid rgba(148, 163, 184, 0.08);

  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
}

.grafana-iframe-wrapper iframe {
  position: absolute;

  top: 0;
  left: 0;

  width: 100%;
  height: 100%;

  border: none;

  opacity: 1;

  transition: opacity 0.3s ease;
}

/* =====================================================
   MRTG FULL-HEIGHT VIEW (NO INNER SCROLLBAR)
===================================================== */

body.mrtg-view {
  height: auto !important;
  min-height: 100vh !important;
  align-items: flex-start !important;
  padding: 1.5rem 1rem !important;
  overflow-y: auto !important;
}

.container.mrtg-view {
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
}

#grafanaDashboardContainer.mrtg-view {
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
}

.grafana-iframe-wrapper.mrtg-view {
  position: relative !important;
  height: auto !important;
  min-height: 500px !important;
  overflow: visible !important;
}

.grafana-iframe-wrapper.mrtg-view iframe {
  position: static !important;
  width: 100% !important;
  height: 600px;
  border: none !important;
  overflow: hidden !important;
}

/* =====================================================
   LOADING
===================================================== */

.loading-message {
  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  color: #94a3b8;

  display: none;

  z-index: 10;
}

.grafana-iframe-wrapper.loading .loading-message {
  display: block;
}

.grafana-iframe-wrapper.loading::after {
  content: "";

  position: absolute;

  top: 50%;
  left: 50%;

  width: 32px;
  height: 32px;

  margin-left: -16px;
  margin-top: 20px;

  border-radius: 50%;

  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;

  animation: spin 0.8s linear infinite;

  z-index: 10;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }

  .container {
    height: calc(100vh - 1rem);
    padding: 1rem;
    border-radius: 1rem;
  }

  #landingPage {
    padding: 1.5rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-header h1 {
    text-align: center;
    font-size: 1rem;
  }

  .time-filter-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .grafana-iframe-wrapper {
    min-height: 400px;
  }
}
