/* =================================================================================================
   SyncNex Dashboard CSS (tidied + explained)
   -------------------------------------------------------------------------------------------------
   What this file covers:
   - Header / top bars
   - Display boxes + card grids
   - Cumulative (top) cards
   - Detail (second box) cards
   - Hover swap: text -> graph overlay (for both card types)
   - Radio-controlled detail sections
   - Staggered rows (label/value lines)
   - Service-card hover overlay (your home/services section)
   - Login box styling

   Key pattern used for charts:
   - Text stays in normal document flow (so layout doesn’t jump)
   - Graph view is an absolutely positioned overlay (so it doesn’t affect layout)
   - On hover we fade text out and fade graph in
================================================================================================= */


/* ================================================================================================
   HEADER + TOP BARS
================================================================================================ */

/* Main page header */
#syncnex-header {
  margin: 1rem 0 0.5rem 1rem;
}

/* Blue underline under header */
#syncnex-header-underline {
  width: 100%;
  height: 2px;
  background: #0091E4;
  margin-top: 0.3rem;
  margin-bottom: 1rem;
}

/* Logout bar that holds Dashboard/Log Out buttons */
#syncnex-logoutbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding-right: 1rem;
  margin-top: -4.4rem;
  margin-bottom: 1.2rem;
  box-sizing: border-box;
  gap: 0.6rem;
}

/* Top buttons styling */
#syncnex-top-button {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 2px solid #1f2a3f;
  border-radius: 10px;
  color: #99A0AE;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  background: radial-gradient(circle at top left, rgba(0,145,228,0.15), rgba(12,19,40,0.95));
  box-shadow: 0 5px 14px rgba(0,0,0,0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

#syncnex-top-button:hover {
  background: rgba(0,145,228,0.12);
  border-color: #0091E4;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transform: translateY(-1px);
  color: #ffffff;
}

/* Topbar row: "Hi, user" and "Site - X" */
#syncnex-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 1rem;
  margin: 0.9rem 0 0.2rem 0;
  box-sizing: border-box;
}

#syncnex-topbar-left,
#syncnex-topbar-right {
  color: #99A0AE;
  font-size: 1rem;
}

#syncnex-topbar-right {
  margin-left: auto;
  text-align: right;
}

#syncnex-second-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 1rem;
  margin: 0.9rem 0 0.2rem 0;
  box-sizing: border-box;
}

#syncnex-second-bar-left,
#syncnex-second-bar-right {
  color: #99A0AE;
  font-size: 1rem;
}

#syncnex-second-bar-right {
  margin-left: auto;
  text-align: right;
}

/* Main spacing under header areas */
#syncnex-main {
  margin-top: 0 !important;
  padding-top: 0.2rem !important;
  flex: 1; /* take remaining height so footer can stick to bottom */
}


/* ================================================================================================
   DISPLAY BOXES (outer containers)
================================================================================================ */

.syncnex-display-box {
  width: 100%;
  background: rgba(12,19,40,0.95);
  border: 2px solid #1f2a3f;
  border-radius: 14px;
  padding: 1.3rem 1.2rem;
  margin-top: 1rem;
  box-sizing: border-box;
  box-shadow: 0 10px 22px rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
}

/* Adds extra space between “main” display boxes (but not between detail boxes) */
.syncnex-display-box:not(.detail-box) + .syncnex-display-box:not(.detail-box) {
  margin-top: 3rem;
}

.syncnex-display-box-title {
  color: #99A0AE;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 600;
}


/* ================================================================================================
   GRIDS
================================================================================================ */

.syncnex-button-grid {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 2.5rem;
  margin-top: 1.3rem;
}

.syncnex-totals-grid {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 2.5rem;
  margin-top: 1.3rem;
}


/* ================================================================================================
   DISPLAY BOX BUTTONS (Large)
================================================================================================ */

.syncnex-large-button {
  flex: 1;
  display: block;
  text-align: center;
  padding: 0.8rem;
  border: 2px solid #1f2a3f;
  border-radius: 10px;
  color: #99A0AE;
  font-weight: 600;
  text-decoration: none;
  background: radial-gradient(circle at top left, rgba(0,145,228,0.15),rgba(12,19,40,0.95));
  box-shadow: 0 5px 14px rgba(0,0,0,0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.syncnex-large-button:hover {
  background: rgba(0,145,228,0.12);
  border-color: #0091E4;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transform: translateY(-1px);
  color: #ffffff;
}


/* ================================================================================================
   CARD HEADERS + ICON BUTTON
================================================================================================ */

/* Shared header layout: title centered, icon button pinned right */
.syncnex-cumulative-total-header,
.syncnex-total-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center; /* centres the title */
  width: 100%;
  z-index: 5; /* keeps header above the graph overlay */
}

.syncnex-cumulative-total-title,
.syncnex-total-title {
  margin: 0;                 /* prevents vertical drift */
  text-align: center;
  width: 100%;
  font-size: 0.9rem;
  color: #99A0AE;
  font-weight: 600;
}

/* The little “expand” button in card headers */
.card-icon-button {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #1f2a3f;
  background: rgba(255,255,255,0.05);
  text-decoration: none;
  transition: 0.15s ease;
}

.card-icon-button:hover {
  background: rgba(0,145,228,0.12);
  border-color: #0091E4;
}


/* ================================================================================================
   CUMULATIVE (TOP) CARDS
   Hover swap: text -> graph overlay (no layout shifting)
================================================================================================ */

.syncnex-cumulative-total-card {
  flex: 1;
  background: radial-gradient(circle at top left, rgba(0,145,228,0.15), rgba(12,19,40,0.95));
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 2px solid #1f2a3f;
  box-sizing: border-box;
  height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
}

/* TEXT view: centered content in remaining space under header */
.syncnex-cumulative-total-card .card-view--text {
  flex: 1; /* fill remaining height below header */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center; /* centre horizontally */
  text-align: center;
  z-index: 1;
  transition: opacity 0.2s ease;
  gap: 0.35rem;
}

/* GRAPH view: overlay fills card, padded to sit below header row */
.syncnex-cumulative-total-card .card-view--graph {
  position: absolute;
  inset: 0;          /* fill whole card */
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;

  /* keep chart below header row */
  padding: 42px 1rem 0.9rem 1rem; /* tweak 42px if needed */
  box-sizing: border-box;
}

/* Hover swap */
.syncnex-cumulative-total-card:hover .card-view--text {
  opacity: 0;
}

.syncnex-cumulative-total-card:hover .card-view--graph {
  opacity: 1;
  pointer-events: auto;
}

/* Canvas fills the graph area */
.syncnex-cumulative-total-card .card-chart {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Top card number + unit */
.syncnex-cumulative-total-value {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 2rem;
  color: #ffffff;
  font-weight: 700;
}

.syncnex-cumulative-total-unit {
  margin-top: 0;
  font-size: 0.9rem;
  color: #99A0AE;
  font-weight: 600;
}

/* Machine status text in top card 1 */
.syncnex-cumulative-machine-status {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 2rem;
  font-weight: 700;
}

/* Machine status colours */
.status-running   { color: #08fc28; }
.status-ready     { color: #99A0AE; }
.status-setup     { color: #ffc107; }
.status-breakdown { color: #FF0000; }


/* ================================================================================================
   DETAIL (SECOND BOX) CARDS
   Hover swap: text -> graph overlay (no layout shifting)
================================================================================================ */

.syncnex-total-card {
  flex: 1;
  background: radial-gradient(circle at top left, rgba(0,145,228,0.15), rgba(12,19,40,0.95));
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 2px solid #1f2a3f;
  box-sizing: border-box;
  height: 175px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
}

/* Keep text in normal layout */
.syncnex-total-card .card-view--text {
  position: relative;
  z-index: 1;
  transition: opacity 0.2s ease;
}

/* Graph overlays on hover */
.syncnex-total-card .card-view--graph {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;

  /* keep chart below the card header/title */
  padding: 55px 1rem 0.9rem 1rem; /* tweak if needed */
  box-sizing: border-box;
}

/* Hover swap */
.syncnex-total-card:hover .card-view--text { opacity: 0; }
.syncnex-total-card:hover .card-view--graph {
  opacity: 1;
  pointer-events: auto;
}

/* Canvas fills the graph area */
.syncnex-total-card .card-chart {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Detail cards value / unit helpers */
.syncnex-total-value,
.syncnex-total-cost,
.syncnex-machine-status {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 2rem;
  color: #ffffff;
  font-weight: 700;
}

.syncnex-machine-status {
  color: #08fc28;
}

.syncnex-total-unit {
  margin-top: 0;
  font-size: 0.9rem;
  color: #99A0AE;
  font-weight: 600;
}


/* ================================================================================================
   DETAIL BOX VISIBILITY (radio controlled)
   Only one of the detail sections is shown at a time.
================================================================================================ */

.detail-box {
  display: none;
  margin-top: 1.5rem;
}

#detail-status-radio:checked   ~ #detail-status   { display: block; }
#detail-jobs-radio:checked     ~ #detail-jobs     { display: block; }
#detail-material-radio:checked ~ #detail-material { display: block; }
#detail-energy-radio:checked   ~ #detail-energy   { display: block; }


/* ================================================================================================
   STAGGERED ROWS (label/value pairs inside detail cards)
================================================================================================ */

.syncnex-staggered-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 1.2rem;
  padding: 0 2rem;
}

.syncnex-staggered-text-1  { font-size: 0.9rem; color: #66ff00; font-weight: 600; margin: 0; }
.syncnex-staggered-text-2  { font-size: 0.9rem; color: #99A0AE; font-weight: 600; margin: 0; }
.syncnex-staggered-text-3  { font-size: 0.9rem; color: #FF0000; font-weight: 600; margin: 0; }

.syncnex-staggered-value-1 { font-size: 0.9rem; color: #66ff00; font-weight: 600; margin: 0; text-align: right; }
.syncnex-staggered-value-2 { font-size: 0.9rem; color: #99A0AE; font-weight: 600; margin: 0; text-align: right; }
.syncnex-staggered-value-3 { font-size: 0.9rem; color: #FF0000; font-weight: 600; margin: 0; text-align: right; }


/* ================================================================================================
   SERVICE CARDS (your home/services section)
   - Overlay appears on hover
   - Base content fades out on hover
================================================================================================ */

.syncnex-services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2.0rem;
  align-items: stretch;
}

.service-card {
  position: relative; /* required for absolute overlay */
  overflow: hidden;   /* keeps overlay inside rounded corners */
}

.hover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out;
  z-index: 3;
  color: inherit;
}

.service-card:hover .hover-overlay {
  opacity: 1;
  pointer-events: auto;
}

.hover-title {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #99A0AE;
}

.hover-number-wrapper {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.hover-number {
  margin-top: 2rem;
  margin-bottom: 1.2rem;
  font-size: 2rem;
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
}

.hover-unit {
  font-size: 0.9rem;
  font-weight: 600;
  color: #99A0AE;
}

/* Fade out the base content on hover (overlay remains visible) */
.service-card > h3,
.service-card > p {
  position: relative;
  z-index: 1;
  transition: opacity 0.25s ease-in-out;
}

.service-card:hover > h3,
.service-card:hover > p {
  opacity: 0;
}

/* Ensure overlay text never gets hidden by any inherited hover rules */
.service-card:hover .hover-overlay h3,
.service-card:hover .hover-overlay p,
.service-card:hover .hover-overlay .syncnex-total-title {
  opacity: 1 !important;
}

.syncnex-hover-header {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #99A0AE;
}


/* ================================================================================================
   OPTIONAL “NEXT BUTTONS” / TIME TOGGLES (kept as-is)
================================================================================================ */

.time-toggle {
  cursor: pointer;
  user-select: none;
}
.time-toggle:hover { opacity: 0.85; }

.time-arrow {
  cursor: pointer;
  display: inline-block;
  margin-right: 6px;
  user-select: none;
}
.time-arrow:hover { opacity: 0.7; }

.time-label { cursor: default; }


/* ================================================================================================
   LOGIN BOX
================================================================================================ */

.syncnex-login-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.syncnex-login-box {
  background: rgba(12, 19, 40, 0.95);
  padding: 1.2rem 1.5rem;
  border: 2px solid #1f2a3f;
  border-radius: 12px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  text-align: left;
}

.syncnex-login-box h2 {
  margin: 0 0 1rem 0;
  font-size: 1.4rem;
  text-align: center;
  color: #99A0AE;
}

.syncnex-login-box label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #99A0AE;
  text-align: center;
}

.syncnex-login-box input {
  width: 100%;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid #2f3a57;
  background: #0f1525;
  color: #99a0ae;
}

.syncnex-login-box button {
  margin-top: 1.5rem;
  padding: 0.8rem 1.6rem;
  border: 2px solid #1f2a3f;
  border-radius: 10px;
  color: #99A0AE;
  font-weight: 600;
  text-decoration: none;
  background: radial-gradient(circle at top left, rgba(0,145,228,0.15), rgba(12,19,40,0.95));
  box-shadow: 0 5px 14px rgba(0,0,0,0.25);
  transition: transform 0.15s ease,
              box-shadow 0.15s ease,
              background 0.15s ease,
              border-color 0.15s ease;
  width: 100%;
}

.syncnex-login-box button:hover {
  background: rgba(0, 145, 228, 0.12);
  border-color: #0091E4;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transform: translateY(-1px);
  color: white;
}

.syncnex-error {
  margin-top: 0.8rem;
  color: #ff6b6b;
  font-size: 0.9rem;
  text-align: center;
}
