:root {
  --bg: #0b1220;

  /* Glass system */
  --glass: rgba(255,255,255,0.10);
  --glass2: rgba(255,255,255,0.05);
  --stroke: rgba(255,255,255,0.16);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);
  --shadow: 0 18px 60px rgba(0,0,0,0.45);
  --radius: 18px;
  --gap: 10px;

  /* Wallpaper controls */
  --wall-blur: 0px;
  --overlay-dark: 0.78; /* 0.55 - 0.85 (okunabilirlik için 0.72-0.82 ideal) */
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
body {
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ===== Wallpaper layers (2 katman) =====
   HTML'de ideal yapı:
   <div id="wallpaper"></div>
   <div id="wallpaperOverlay"></div>
*/
#wallpaper{
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.03);
  filter: blur(var(--wall-blur));
  opacity: 1;
  transition: opacity 600ms ease;
}

/* Overlay katmanı: hem koyulaştırır hem noise ekler */
#wallpaperOverlay{
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* koyulaştırma (asıl okunabilirlik burada) */
#wallpaperOverlay::before{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(0,0,0,var(--overlay-dark));
}

/* noise/texture */
#wallpaperOverlay::after{
  content:"";
  position:absolute;
  inset:0;
  background-image: url("data:image/svg+xml;utf8,\
  <svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'>\
  <filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/></filter>\
  <rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/>\
  </svg>");
  opacity: 1;
}

/* ===== App layout ===== */
#app{
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  grid-template-rows: 56px 1fr 42px;
  grid-template-areas:
    "top top top"
    "left desktop right"
    "bottom bottom bottom";
  gap: var(--gap);
  padding: var(--gap);
}

/* ===== Bars - glass + shaped border ===== */
.bar{
  background: linear-gradient(180deg, var(--glass), var(--glass2));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  position: relative;
  overflow: hidden;
}

/* Gradient border line (shaped) */
.bar::before{
  content:"";
  position:absolute;
  inset:0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg,
    rgba(120,140,255,0.60),
    rgba(0,255,220,0.28),
    rgba(255,255,255,0.14));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events:none;
  opacity: 0.9;
}

/* Inner shine */
.bar::after{
  content:"";
  position:absolute;
  left:-25%;
  top:-65%;
  width:150%;
  height:140%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.22), transparent 55%);
  pointer-events:none;
  opacity:0.55;
}

.top { grid-area: top; display:flex; align-items:center; padding: 0 14px; }
.left { grid-area: left; padding: 10px; display:flex; flex-direction:column; }
.right { grid-area: right; padding: 10px; display:flex; flex-direction:column; }
.bottom { grid-area: bottom; display:flex; align-items:center; padding: 0 14px; }

.brand { font-weight: 800; letter-spacing: 0.2px; }
.spacer { flex: 1; }

.pill {
  font-size: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}

/* buton gibi pill */
.pill-btn{
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.07);
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.pill-btn:hover{ background: rgba(255,255,255,0.10); }
.pill-btn:active{ transform: translateY(1px); }

.bar-title { font-size: 12px; color: var(--muted); padding: 6px 6px 10px; }

.nav { display:flex; flex-direction:column; gap: 8px; }
.nav button{
  width: 100%;
  text-align: left;
  padding: 11px 11px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.nav button:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.26);
  transform: translateY(-1px);
}

/* ===== Desktop ===== */
.desktop{
  grid-area: desktop;
  position: relative;
  border-radius: var(--radius);
  border: 1px dashed rgba(255,255,255,0.14);
  overflow: hidden;
  min-height: 200px;
}

/* OKUNABİLİRLİK: desktop üstüne ekstra scrim (opsiyonel ama etkili)
   wallpaper overlay zaten var; bunu düşük tutuyoruz. */
.desktop::before{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.12);
  pointer-events:none;
  z-index: 0;
}

/* ===== Windows ===== */
.window{
  position: absolute;
  width: 720px;
  height: 440px;
  min-width: 420px;      /* resize stabilitesi */
  min-height: 260px;     /* resize stabilitesi */
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(10,16,28,0.78);
  box-shadow: var(--shadow);
  overflow: hidden;
  display:flex;
  flex-direction:column;
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  z-index: 1; /* desktop::before altında kalmasın */
}

.win-title{
  height: 42px;
  display:flex;
  align-items:center;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  cursor: move;
  gap: 10px;
  user-select: none;
}

.win-title .t{ font-size: 13px; color: var(--muted); }
.win-title .btns{ margin-left:auto; display:flex; gap: 8px; }
.win-title .btn{
  width: 28px; height: 28px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
}
.win-title .btn:hover{ background: rgba(255,255,255,0.10); }

.win-title .btn.max::before{
  content: "";
  display:block;
  width: 11px; height: 11px;
  border: 2px solid rgba(255,255,255,0.75);
  border-radius: 2px;
}

.win-body{ flex: 1; position: relative; }
.win-body iframe{
  width:100%;
  height:100%;
  border:0;
  background: rgba(0,0,0,0.18); /* iframe yüklenene kadar koyu */
}

/* Maximize */
.window.maximized{
  left: 12px !important;
  top: 12px !important;
  width: calc(100% - 24px) !important;
  height: calc(100% - 24px) !important;
  transform: none !important;
}

/* Resize handle (CSS yalnızca görünüm; JS pointer capture ile stabil olur) */
.window .resize-handle{
  position:absolute;
  right: 6px;
  bottom: 6px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  opacity: 0.55;
  background:
    linear-gradient(135deg, transparent 0 45%,
      rgba(255,255,255,0.40) 45% 52%,
      transparent 52% 65%,
      rgba(255,255,255,0.25) 65% 72%,
      transparent 72% 100%);
}
.window .resize-handle:hover{ opacity: 0.85; }

/* ===== Right panel ===== */
.right-panel{ padding: 6px; display:flex; flex-direction:column; gap: 8px; }
.muted{ color: var(--muted); font-size: 13px; }

/* Right dock action buttons */
.right-panel .btn{
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  text-align: left;
}
.right-panel .btn:hover{ background: rgba(255,255,255,0.10); }
.right-panel .btn.primary{
  background: rgba(90,160,255,0.22);
  border-color: rgba(90,160,255,0.35);
}
.right-panel .btn.primary:hover{ background: rgba(90,160,255,0.30); }
.right-panel .hr{
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 12px 0 2px;
}

/* ===== AUTH LOCK: giriş yokken shell’i gizle ===== */
body.auth-locked #app {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}
body.auth-locked #app .top,
body.auth-locked #app .left,
body.auth-locked #app .right,
body.auth-locked #app .bottom,
body.auth-locked #app .desktop {
  opacity: 0.12;
}

/* ===== Login overlay ===== */
#loginOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(6, 10, 18, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#loginOverlay.show { display: flex; }

#loginBox {
  width: min(420px, 100%);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.92);
}

#loginBox .title {
  font-weight: 800;
  margin-bottom: 10px;
}
#loginBox .subtitle{
  font-size: 12px;
  opacity: 0.72;
  margin: -6px 0 10px;
}

#loginBox .row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

#loginBox label { font-size: 12px; opacity: 0.75; }

#loginBox input {
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  padding: 0 12px;
  outline: none;
}

#loginBox input:focus{
  border-color: rgba(90,160,255,0.40);
  box-shadow: 0 0 0 3px rgba(90,160,255,0.15);
}

#loginBox button{
  width: 100%;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(90,160,255,0.22);
  cursor: pointer;
  color: rgba(255,255,255,0.92);
  font-weight: 700;
}
#loginBox button:hover{ background: rgba(90,160,255,0.30); }

#loginError {
  font-size: 13px;
  color: rgba(255,140,140,0.92);
  min-height: 18px;
}

/* ===== Dock hidden ===== */
body.dock-hidden #app{
  grid-template-columns: 260px 1fr 0px;
}

/* sağ barı gerçekten gizle (görsel artık yok) */
body.dock-hidden .right{
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: hidden;
}
body.dock-hidden .right::before,
body.dock-hidden .right::after{
  display:none !important;
}
body.dock-hidden .right *{
  display: none !important;
}
