/* =========================================================
   Centrana OS – Global Styles
   Clean · Blackbox · Responsive
   ========================================================= */

/* =========================================================
   THEME TOKENS
   ========================================================= */
:root{
  --bg: #0b0f14;

  /* Panels / Surfaces */
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.10);
  --panel3: rgba(0,0,0,0.22);

  /* Borders */
  --border: rgba(255,255,255,0.14);
  --border2: rgba(255,255,255,0.10);

  /* Text */
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);

  /* Accents */
  --accent: #7c5cff;
  --accent2: #35d0ff;
  --danger: #ff4d6d;
  --warn: #ffb94d;
  --ok: #1dd3b0;

  /* Shadow & Radii */
  --shadow: 0 20px 60px rgba(0,0,0,0.55);
  --radius: 18px;
  --radius2: 14px;

  /* Layout */
  --max: 1600px; /* bleibt: Dashboard Grundaufbau nicht verändern */
  --gap: 16px;
}

/* =========================================================
   RESET / BASE
   ========================================================= */
*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(124,92,255,0.25), transparent 60%),
    radial-gradient(900px 700px at 85% 10%, rgba(53,208,255,0.18), transparent 60%),
    linear-gradient(180deg, #070a0f 0%, #0b0f14 40%, #06080d 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

a{ color:inherit; text-decoration:none; }
img{ max-width:100%; height:auto; display:block; }

.muted{ color: var(--muted); }

/* =========================================================
   LAYOUT
   ========================================================= */
.app{ min-height:100%; display:flex; flex-direction:column; }
.main{ flex:1; padding: 26px 0 34px; }

.container{
  width:100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar{
  position: sticky;
  top:0;
  z-index:50;
  background: rgba(5,7,10,0.65);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: var(--gap);
  padding: 14px 16px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width:0;
}

.brand-logo{
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 6px;
}

.brand-text{ min-width:0; }
.brand-name{
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space:nowrap;
}
.brand-sub{
  font-size: 12px;
  color: var(--muted);
  white-space:nowrap;
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap: 10px;
}

.userchip{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  white-space:nowrap;
}
.dot{
  width: 9px; height: 9px; border-radius:999px;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(29,211,176,0.15);
}
.userchip-name{ font-weight:650; font-size:13px; }
.userchip-role{ color: var(--muted); font-size:12px; }

/* =========================================================
   BUTTONS (einheitlich "Blackbox")
   ========================================================= */
.btn{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:650;
  transition: transform .06s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover{
  background: var(--panel2);
  border-color: rgba(255,255,255,0.20);
}
.btn:active{ transform: translateY(1px); }

.btn-primary{
  background: linear-gradient(135deg, rgba(124,92,255,0.95), rgba(53,208,255,0.75));
  border-color: rgba(124,92,255,0.45);
}
.btn-primary:hover{
  border-color: rgba(53,208,255,0.45);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.12);
}

.btn-ghost{ background: transparent; }

.btn:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* =========================================================
   FORMS / INPUTS (einheitlich)
   ========================================================= */
.input, .field input, select, textarea{
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.28);
  color: var(--text);
  border-radius: 12px;
  outline:none;
}

.input, select{
  width:100%;
  padding: 10px 12px;
}

textarea{
  width:100%;
  padding: 12px;
  resize: vertical;
}

.input:focus, .field input:focus, select:focus, textarea:focus{
  border-color: rgba(124,92,255,0.55);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.14);
}

/* =========================================================
   FLASH MESSAGES
   ========================================================= */
.flash{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius2);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.flash-error{ border-color: rgba(255,77,109,0.35); }
.flash-success{ border-color: rgba(29,211,176,0.35); }
.flash-info{ border-color: rgba(53,208,255,0.25); }

/* =========================================================
   CARDS / PANELS (einheitlich)
   ========================================================= */
.card{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-head h1{
  margin: 0 0 6px;
  font-size: 22px;
}

/* =========================================================
   DASHBOARD – GRID / TILES (Grundaufbau bleibt)
   ========================================================= */
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: var(--gap);
  margin-top: 16px;
}

.tile{
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.16);
  border-radius: var(--radius2);
  padding: 14px;
}

.tile-title{ color: var(--muted); font-size:12px; }
.tile-value{ font-size:18px; font-weight:800; margin-top:6px; }
.tile-sub{ font-size:12px; margin-top:6px; }

/* =========================================================
   LOGIN – Blackbox Design
   ========================================================= */
.auth{
  display:flex;
  justify-content:center;
  align-items:center;
  min-height: calc(100vh - 120px);
}

.auth-shell{
  width:100%;
  max-width: 980px;
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow:hidden;
  background: rgba(255,255,255,0.05);
  box-shadow: var(--shadow);
}

/* Left / Hero */
.auth-hero{
  position:relative;
  padding: 34px 26px;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(124,92,255,0.26), transparent 60%),
    radial-gradient(700px 420px at 85% 20%, rgba(53,208,255,0.18), transparent 60%),
    rgba(255,255,255,0.03);
}

.auth-hero-inner{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap: 12px;
}

.auth-hero-logo{
  width: 150px;
  height: 150px;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  padding: 16px;
}

.auth-hero-title{
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.auth-hero-sub{
  font-size: 14px;
  color: var(--muted);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
}

.auth-hero-footer{
  position:absolute;
  left:26px;
  right:26px;
  bottom:22px;
  display:flex;
  justify-content:space-between;
  font-size:12px;
}

/* Right / Panel */
.auth-panel{
  padding: 26px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  background: rgba(0,0,0,0.18);
}

.auth-panel-head h1{
  margin:0 0 6px;
  font-size:22px;
}

.auth-panel-head p{
  margin:0 0 18px;
}

.form{
  width:100%;
  display:flex;
  flex-direction:column;
  gap: 12px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.field span{
  font-size:12px;
  color: var(--muted);
}

.auth-panel-footer{
  margin-top: 14px;
  font-size:12px;
  display:flex;
  justify-content:flex-end;
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer{
  border-top: 1px solid var(--border);
  background: rgba(5,7,10,0.65);
  backdrop-filter: blur(14px);
}
.footer-inner{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding: 14px 16px;
  font-size:12px;
}

/* =========================================================
   RESPONSIVE – GLOBAL
   ========================================================= */
@media (max-width: 860px){
  .auth-shell{ grid-template-columns:1fr; }
  .auth-hero{ border-right:none; border-bottom:1px solid var(--border); }
  .auth-hero-footer{ position:static; margin-top:18px; }
  .grid{ grid-template-columns:1fr; }
  .brand-sub{ display:none; }
}

@media (max-width: 420px){
  .auth-hero{ padding: 26px 18px; }
  .auth-panel{ padding: 18px; }
  .auth-hero-title{ font-size: 28px; }
  .brand-logo{ width:42px; height:42px; }
}

/* =========================================================
   DASHBOARD – HEALTH (Grundaufbau bleibt)
   ========================================================= */
.health-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px !important;
  margin-top: 16px !important;
}

.health-tile{
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.16);
  border-radius: var(--radius2);
  padding: 14px;
}

.health-title{
  font-size: 12px;
  color: var(--muted);
}

.health-value{
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.bar{
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
  overflow:hidden;
}

.bar-fill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,92,255,0.95), rgba(53,208,255,0.75));
  transition: width 120ms linear;
}

.bar-fill.warn{
  background: linear-gradient(135deg, rgba(255,185,77,0.95), rgba(255,120,60,0.75));
}

.bar-fill.hot{
  background: linear-gradient(135deg, rgba(255,77,109,0.95), rgba(255,60,120,0.75));
}

.health-meta{
  margin-top: 10px;
  font-size: 12px;
  display:flex;
  justify-content:space-between;
  gap: 8px;
  flex-wrap:wrap;
}

.health-foot{
  margin-top: 14px;
  font-size: 12px;
}

@media (max-width: 960px){
  .health-grid{ grid-template-columns: 1fr; }
}

/* =========================================================
   SENSORS – compact grid tiles + sparklines (Grundaufbau bleibt)
   ========================================================= */
.sensor-sep{
  margin: 14px 0;
  height: 1px;
  background: rgba(255,255,255,0.10);
}

.sensor-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.sensors-compact{
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.sensor-tile{
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.16);
  border-radius: var(--radius2);
  padding: 14px;
}

.sensor-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.sensor-title{
  font-size: 12px;
  color: var(--muted);
}

.sensor-trend{
  font-weight: 900;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  min-width: 34px;
  text-align:center;
}

.sensor-trend.up{ color: rgba(29,211,176,0.95); border-color: rgba(29,211,176,0.25); }
.sensor-trend.down{ color: rgba(255,77,109,0.95); border-color: rgba(255,77,109,0.25); }
.sensor-trend.neutral{ color: rgba(255,255,255,0.75); }

.sensor-value{
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.sensor-sub{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}

.sensor-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-top: 10px;
}

.sensor-name{
  font-size: 12px;
  color: rgba(255,255,255,0.78);
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.sensor-now{
  font-size: 12px;
  font-weight: 900;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
}

.spark{
  margin-top: 8px;
  height: 26px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  overflow:hidden;
}

.spark svg{
  width:100%;
  height:100%;
  display:block;
}

.spark polyline{
  fill: none;
  stroke: rgba(53,208,255,0.85);
  stroke-width: 2;
}

.spark .fill{
  fill: rgba(124,92,255,0.14);
}

.sensor-tile.flat{
  opacity: 0.85;
}
.sensor-tile.flat .sensor-trend{
  opacity: 0.8;
}

@media (max-width: 960px){
  .sensor-grid{ grid-template-columns: 1fr; }
}

/* =========================================================
   NGINX – UI (Farben an Global Tokens angepasst)
   ========================================================= */
.nginx-page{ padding: 14px; }
.nginx-header{ display:flex; align-items:flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.nginx-sub{ opacity: .75; margin-top: 4px; }

.nginx-header-actions{ display:flex; gap: 8px; flex-wrap: wrap; }

.nginx-layout{
  display: grid;
  grid-template-columns: 320px 1fr 360px;
  gap: 12px;
  align-items: stretch;
}

/* NGINX Card uses global .card – aber die Seiten brauchen "kleinere" padding */
.nginx-sides,
.nginx-editor,
.nginx-domains{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.card-head{ display:flex; align-items:center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-title{ font-weight: 800; letter-spacing: .2px; }

.btn-small{ padding: 6px 8px; border-radius: 10px; font-size: 12px; }

.input{ width: 100%; padding: 9px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.28); color: inherit; }

.textarea{
  width: 100%;
  height: 420px;
  resize: vertical;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.28);
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.35;
}

.label{ display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.row{ display:flex; flex-direction: column; gap: 6px; }

.nginx-sides{ height: calc(100vh - 140px); display:flex; flex-direction: column; }
.nginx-search{ display:flex; gap: 8px; margin-bottom: 10px; }
.nginx-site-list{ overflow:auto; flex: 1; border-top: 1px solid var(--border2); padding-top: 10px; }

.site-item{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  background: rgba(0,0,0,0.10);
}
.site-item:hover{ background: rgba(0,0,0,0.18); border-color: rgba(255,255,255,0.10); }
.site-item.active{
  border-color: rgba(124,92,255,0.35);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.10);
}

.site-meta{ display:flex; gap: 8px; align-items:center; }
.badge{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  opacity: .95;
  background: rgba(0,0,0,0.18);
}
.badge.on{ border-color: rgba(29,211,176,0.30); color: rgba(29,211,176,0.95); }
.badge.off{ border-color: rgba(255,77,109,0.30); color: rgba(255,77,109,0.95); }

.nginx-editor{ height: calc(100vh - 140px); display:flex; flex-direction: column; }
.nginx-editor-top{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.card-actions{ display:flex; gap: 8px; flex-wrap: wrap; }

.pill{
  margin-left: 10px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  opacity: .85;
  background: rgba(0,0,0,0.18);
}

.seg{ display:flex; gap: 8px; }
.seg-btn{
  flex: 1;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.20);
  cursor: pointer;
  color: inherit;
}
.seg-active{
  border-color: rgba(124,92,255,0.45);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.10);
  font-weight: 800;
}

.nginx-panel{ flex: 1; display:flex; flex-direction: column; gap: 10px; }
.hidden{ display:none; }

.tpl-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpl-card{
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,0.16);
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.tpl-title{ font-weight: 800; }
.tpl-row{ display:flex; flex-direction: column; gap: 6px; }

.ssl-grid{ display:grid; grid-template-columns: 1fr; gap: 10px; }
.ssl-title{ font-weight: 800; margin-bottom: 6px; }
.ssl-row{ display:flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.ssl-actions{ display:flex; gap: 8px; flex-wrap: wrap; }

.nginx-domains{ height: calc(100vh - 140px); display:flex; flex-direction: column; }
.nginx-domain-list{ overflow:auto; flex: 1; border-top: 1px solid var(--border2); padding-top: 10px; }

.domain-item{
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  margin-bottom: 8px;
  background: rgba(0,0,0,0.14);
}
.domain-top{ display:flex; justify-content: space-between; gap: 10px; }
.domain-name{ font-weight: 800; }
.domain-sub{ font-size: 12px; color: var(--muted); margin-top: 4px; }

.nginx-output{ margin-top: 10px; }
.out-head{ font-weight: 800; margin-bottom: 6px; color: var(--muted); }
.output{
  min-height: 120px;
  max-height: 220px;
  overflow:auto;
  white-space: pre-wrap;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: rgba(0,0,0,0.22);
}

.hint{ font-size: 12px; color: var(--muted); }

@media (max-width: 1200px){
  .nginx-layout{ grid-template-columns: 320px 1fr; }
  .nginx-domains{ display:none; }
  .tpl-grid{ grid-template-columns: 1fr; }
}
@media (max-width: 820px){
  .nginx-layout{ grid-template-columns: 1fr; }
  .nginx-sides, .nginx-editor{ height: auto; }
  .nginx-editor-top{ grid-template-columns: 1fr; }
}

/* =========================================================
   MENU – Burger Menü (Desktop immer offen, Mobile toggle)
   (nur CSS – JS kann später die Klasse .nav-open togglen)
   ========================================================= */

/* Wrapper (Layout muss im HBS existieren, z.B. <div class="shell"> ... ) */
.shell{
  display:flex;
  min-height: calc(100vh - 120px);
  gap: 16px;
}

/* Sidebar */
.sidebar{
  width: 280px;
  flex: 0 0 280px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  position: sticky;
  top: 86px; /* unter Topbar */
  height: calc(100vh - 110px);
  overflow:auto;
}

/* Sidebar Links */
.nav{
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.nav a{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(0,0,0,0.12);
  color: var(--text);
}
.nav a:hover{
  background: rgba(0,0,0,0.18);
  border-color: rgba(255,255,255,0.10);
}
.nav a.active{
  border-color: rgba(124,92,255,0.35);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.10);
}

/* Burger Button (im Topbar ideal) */
.burger{
  display:none; /* Desktop: versteckt */
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  align-items:center;
  justify-content:center;
  gap: 6px;
  flex-direction: column;
}
.burger span{
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 99px;
}

/* Content area neben Sidebar */
.shell-main{
  flex: 1;
  min-width: 0;
}

/* Mobile behaviour: Sidebar overlay */
@media (max-width: 980px){
  .shell{ display:block; }
  .burger{ display:flex; }

  .sidebar{
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 82vw;
    max-width: 340px;
    z-index: 200;
    transform: translateX(-105%);
    transition: transform .18s ease;
    border-radius: 0 18px 18px 0;
  }

  /* Overlay */
  .nav-overlay{
    display:none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 150;
  }

  /* Wenn JS .nav-open auf body setzt */
  body.nav-open .sidebar{ transform: translateX(0); }
  body.nav-open .nav-overlay{ display:block; }
}
