/* ===========================================================================
   AdventureNET — Pagina de stare, în paleta porții
   ---------------------------------------------------------------------------
   Se încarcă DUPĂ `page.css` și îi rescrie înfățișarea. Aceeași materie ca
   pe cardurile din ecranul porții: noapte adâncă, muchie ridicată, ramă
   aurie, umbră proprie.

   Antetul primește harta 3D (`js/harta3d.js`, desenată în canvas). Inelele
   vechi din CSS rămân în pagină, dar ascunse: `page.js` le caută, iar
   ștergerea lor din HTML ar rupe scriptul de stare.
   =========================================================================== */

.page-status,
body[data-page="status"] {
  --aur:        #dcb45f;
  --aur-clar:   #fbeec2;
  --aur-stins:  #a8842f;
  --noapte:     #0a1024;
  --regal:      #17264e;
  --txt:        #e9edf6;
  --txt-stins:  #a3adc2;
  --rama:       rgba(220, 180, 95, .30);
  --rama-tare:  rgba(220, 180, 95, .58);
  --verde:      #6fd39a;
  --chihlimbar: #e8b563;
  --rosu:       #f38b7f;

  background: var(--noapte);
  color: var(--txt);
}

/* --------------------------------------------------------------------- */
/*  1. Antetul cu harta                                                   */
/* --------------------------------------------------------------------- */

.status-hero {
  position: relative;
  overflow: hidden;
  min-height: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.25rem 3rem;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(23, 38, 78, .9), transparent 62%),
    linear-gradient(178deg, #101a36 0%, #0a1024 60%, #070c1c 100%);
}

/* Pânza stă în spatele textului și acoperă tot antetul: orbii și stelele
   trebuie să se vadă până în colțuri, nu doar în jurul globului. */
.harta3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.status-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 720px;
}

/* Globul vechi din inele CSS: ascuns, dar prezent pentru `page.js`. */
/* Sfera desenata in canvas este mai mare decat aceasta cutie (vezi `masoara()`
   din harta3d.js: raza = 0.85 din latura ei). Marginea de jos ii face loc sa
   coboare sub medalion fara sa cada peste titlu. */
.status-globe-wrapper {
  position: relative;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  margin: 1.2rem auto 5.4rem;
}

.status-globe {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.globe-ring,
.globe-dots { display: none; }

/* Miezul: medalion cu ramă aurie, în mijlocul hărții */
/*
 * Medalionul de stare NU mai sta in centrul globului.
 *
 * Acolo se deseneaza acum conturul Romaniei, iar un disc de 104px l-ar
 * acoperi complet -- harta ar exista si nu s-ar vedea. Medalionul coboara in
 * dreapta-jos, agatat de marginea sferei, ca o insigna. Harta ramane libera,
 * iar starea se citeste tot dintr-o privire.
 */
.globe-center {
  position: absolute;
  left: 60%;
  top: 60%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #26365f, #141c33 60%, #080d1c);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, .6),
    0 1px 0 rgba(255, 255, 255, .16) inset,
    0 -12px 24px rgba(0, 0, 0, .5) inset;
}

.globe-center::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #dcb45f, #fbeec2 25%, #93691f 55%, #eed597 80%, #dcb45f);
  opacity: .92;
  pointer-events: none;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.2px));
  animation: status-inel 15s linear infinite;
}

@keyframes status-inel { to { transform: rotate(360deg); } }

.globe-center::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(198deg, rgba(255, 255, 255, .3), transparent 46%);
  pointer-events: none;
}

.globe-icon {
  position: relative;
  font-size: 46px;
  line-height: 1;
  color: var(--verde);
  filter: drop-shadow(0 0 14px rgba(111, 211, 154, .55));
}

/* Culoarea miezului urmează starea reală, pe care o pune `page.js`. */
.status-hero.status-degraded .globe-icon,
.globe-icon.is-degraded { color: var(--chihlimbar); filter: drop-shadow(0 0 14px rgba(232, 181, 99, .55)); }
.status-hero.status-down .globe-icon,
.globe-icon.is-down { color: var(--rosu); filter: drop-shadow(0 0 14px rgba(243, 139, 127, .55)); }

.status-hero-title {
  margin: 0 0 .55rem;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.7rem);
  font-weight: 700;
  letter-spacing: .2px;
  background: linear-gradient(96deg, #fbeec2, #dcb45f 58%, #eed597);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.status-hero-subtitle {
  margin: 0 0 1.4rem;
  font-size: 1rem;
  color: var(--txt-stins);
}

.status-update-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.15rem;
  border: 0;
  border-radius: 999px;
  font-size: .86rem;
  color: var(--txt-stins);
  background: linear-gradient(172deg, rgba(46, 60, 104, .5), rgba(10, 16, 36, .9) 66%);
  box-shadow:
    0 0 0 1px var(--rama),
    0 1px 0 rgba(251, 238, 194, .16) inset,
    0 8px 18px rgba(6, 11, 24, .4);
}

.status-update-badge strong { color: var(--aur-clar); font-weight: 600; }
.status-update-badge i { color: var(--aur); }

/* --------------------------------------------------------------------- */
/*  2. Secțiunile                                                         */
/* --------------------------------------------------------------------- */

.page-status .page-main,
body[data-page="status"] .page-main { background: var(--noapte); }

.status-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.2rem 1.25rem;
}

.status-section-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 1.2rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--aur-clar);
}

.status-section-title i,
.status-section-title svg { color: var(--aur); stroke: var(--aur); }

/* --------------------------------------------------------------------- */
/*  3. Plăcile — aceeași materie ca la cardurile porții                   */
/* --------------------------------------------------------------------- */

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.service-card,
.uptime-card,
.maintenance-item,
.incident-item,
.status-subscribe,
.skeleton-card {
  position: relative;
  overflow: hidden;
  height: 100%;
  border: 0;
  border-radius: 18px;
  padding: 1.15rem 1.2rem;
  background: linear-gradient(168deg, rgba(46, 60, 104, .42), rgba(10, 16, 36, .9) 64%);
  box-shadow:
    0 0 0 1px var(--rama),
    0 1px 0 rgba(251, 238, 194, .18) inset,
    0 -12px 26px rgba(0, 0, 0, .4) inset,
    0 14px 26px rgba(6, 11, 24, .46);
  transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .22s cubic-bezier(.22,1,.36,1);
}

.service-card:hover,
.uptime-card:hover,
.incident-item:hover {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px var(--rama-tare),
    0 1px 0 rgba(251, 238, 194, .28) inset,
    0 -12px 26px rgba(0, 0, 0, .38) inset,
    0 24px 40px rgba(6, 11, 24, .56);
}

/* Dâra aurie din capul fiecărei plăci */
.service-card::before,
.uptime-card::before,
.status-subscribe::before {
  content: "";
  position: absolute;
  top: 0; left: 18%; right: 18%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #dcb45f 30%, #fbeec2 50%, #dcb45f 70%, transparent);
  opacity: .75;
}

.service-name,
.uptime-title,
.incident-title,
.maintenance-title,
.subscribe-title { color: var(--aur-clar); }

.service-description,
.incident-description,
.maintenance-description,
.subscribe-desc { color: var(--txt-stins); }

/* Pastila de stare a fiecărui serviciu */
.service-status,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.service-status.operational,
.status-badge.operational {
  color: var(--verde);
  background: rgba(111, 211, 154, .12);
  box-shadow: 0 0 0 1px rgba(111, 211, 154, .32) inset;
}

.service-status.degraded,
.status-badge.degraded {
  color: var(--chihlimbar);
  background: rgba(232, 181, 99, .12);
  box-shadow: 0 0 0 1px rgba(232, 181, 99, .34) inset;
}

.service-status.down,
.status-badge.down {
  color: var(--rosu);
  background: rgba(243, 139, 127, .12);
  box-shadow: 0 0 0 1px rgba(243, 139, 127, .34) inset;
}

/* Uptime */
.uptime-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--aur-clar);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}

.uptime-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 46px;
}

.uptime-bar {
  flex: 1 1 auto;
  min-width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #6fd39a, #2f8f5c);
  opacity: .85;
  transition: opacity .2s ease, transform .2s ease;
}

.uptime-bar:hover { opacity: 1; transform: scaleY(1.06); }
.uptime-bar.degraded { background: linear-gradient(180deg, #e8b563, #a8752a); }
.uptime-bar.down     { background: linear-gradient(180deg, #f38b7f, #a83b2f); }

/* Butonul de abonare la notificări */
.subscribe-btn,
.page-status .btn-primary {
  border: 0;
  border-radius: 12px;
  padding: 12px 22px;
  font-weight: 700;
  color: #241a06;
  background: linear-gradient(178deg, #fbeec2, #dcb45f 52%, #b8933f);
  box-shadow:
    0 7px 18px rgba(220, 180, 95, .34),
    0 1px 0 rgba(255, 255, 255, .6) inset,
    0 -2px 0 rgba(120, 88, 20, .55) inset;
  transition: transform .18s ease, box-shadow .18s ease;
}

.subscribe-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 26px rgba(220, 180, 95, .46),
    0 1px 0 rgba(255, 255, 255, .7) inset,
    0 -2px 0 rgba(120, 88, 20, .55) inset;
}

/* Scheletele de încărcare */
.skeleton-card {
  min-height: 96px;
  background: linear-gradient(100deg,
              rgba(46, 60, 104, .3) 30%,
              rgba(220, 180, 95, .1) 50%,
              rgba(46, 60, 104, .3) 70%);
  background-size: 240% 100%;
  animation: status-schelet 1.5s ease-in-out infinite;
}

@keyframes status-schelet {
  0%   { background-position: 140% 0; }
  100% { background-position: -40% 0; }
}

/* Fereastra de abonare */
.status-modal .modal-content,
.status-modal-content {
  border: 0;
  border-radius: 20px;
  background: linear-gradient(168deg, rgba(24, 34, 64, .97), rgba(10, 16, 36, .98) 62%);
  color: var(--txt);
  box-shadow:
    0 0 0 1px var(--rama),
    0 1px 0 rgba(251, 238, 194, .16) inset,
    0 30px 70px rgba(0, 0, 0, .6);
}

/* --------------------------------------------------------------------- */

@media (max-width: 720px) {
  .status-hero { min-height: 460px; padding: 2.6rem 1rem 2.2rem; }
  .status-globe-wrapper { width: 150px; height: 150px; }
  .globe-center { width: 86px; height: 86px; }
  .globe-icon { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .globe-center::before { animation: none; }
  .skeleton-card { animation: none; }
  .service-card,
  .uptime-card,
  .incident-item { transition: none; }
  .service-card:hover,
  .uptime-card:hover,
  .incident-item:hover { transform: none; }
}

/* Pictograma din miez: `page.css` ii da o dimensiune mica printr-un selector
   la fel de specific, asa ca o rescriem legand-o de parinte. */
.globe-center .globe-icon,
.status-globe .globe-icon {
  font-size: 38px;
  line-height: 1;
}

/* Daca fontul de pictograme nu se incarca, `<i>` ramane gol si miezul pare
   stricat. Semnul de bifa desenat aici apare doar in acel caz. */
.globe-center .globe-icon:empty::after {
  content: "¹3";
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 34px;
  font-weight: 700;
}

/* ===========================================================================
   Structura interioară a plăcii de serviciu
   ---------------------------------------------------------------------------
   Cardul are patru părți: emblemă, nume + descriere, pastila de stare și
   timpul de răspuns. Într-un rând flex de 258px se înghesuiau toate patru pe
   orizontală, iar „Pagina principală și navigare" ieșea pe o coloană de trei
   cuvinte lățime.

   Grilă pe două rânduri: sus emblema și textul, jos starea și răspunsul.
   Fiecare parte are lățimea ei, nimic nu se mai rupe.
   =========================================================================== */

.services-grid .service-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  grid-template-areas:
    "emblema text"
    "stare   raspuns";
  align-items: center;
  gap: .5rem .8rem;
  padding: 1.15rem 1.2rem 1.05rem;
}

.services-grid .service-icon {
  grid-area: emblema;
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #263457, #141c33 62%, #0a1020);
  box-shadow:
    0 6px 14px rgba(0, 0, 0, .5),
    0 1px 0 rgba(255, 255, 255, .14) inset;
}

.services-grid .service-icon::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #dcb45f, #fbeec2 25%, #93691f 55%, #eed597 80%, #dcb45f);
  opacity: .7;
  pointer-events: none;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.3px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.3px));
}

.services-grid .service-icon i,
.services-grid .service-icon svg {
  position: relative;
  font-size: 21px;
  color: var(--aur-clar);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .7));
}

.services-grid .service-info {
  grid-area: text;
  min-width: 0;
}

.services-grid .service-name {
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--aur-clar);
}

.services-grid .service-desc {
  margin-top: .12rem;
  font-size: .78rem;
  line-height: 1.4;
  color: var(--txt-stins);
}

.services-grid .service-status {
  grid-area: stare;
  justify-self: start;
  white-space: nowrap;
}

.services-grid .service-response {
  grid-area: raspuns;
  justify-self: end;
  text-align: right;
  line-height: 1.15;
}

.services-grid .response-time {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--aur-clar);
}

.services-grid .response-label {
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7c869c;
}

/* Bulina din pastila de stare, cu puls propriu */
.services-grid .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: status-bulina 2.2s ease-out infinite;
}

@keyframes status-bulina {
  0%   { box-shadow: 0 0 0 0 rgba(111, 211, 154, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(111, 211, 154, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 211, 154, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .services-grid .status-dot { animation: none; }
}
