/* ==========================================================
   Nexus V2 Customize Space
   Appearance, Layout and Nexus AI controls.
   Loaded after main.css so these rules can safely override
   the older placeholder Customize shell without disturbing
   the rest of Nexus.
   ========================================================== */

:root{
  --nexus-custom-panel-rgb:38,22,61;
  --nexus-custom-panel-alpha:.42;
  --nexus-custom-panel-alpha-strong:.50;
  --nexus-custom-card-alpha:.24;
  --nexus-custom-highlight-rgb:142,92,255;
  --nexus-custom-highlight-alpha:.12;
}

/* Apply the user's panel colour + glass setting to the existing Nexus glass system. */
:root{
  --nexus-panel-glass:
    linear-gradient(145deg,rgba(255,255,255,.065),rgba(255,255,255,.012)),
    rgba(var(--nexus-custom-panel-rgb),var(--nexus-custom-panel-alpha));
  --nexus-panel-glass-strong:
    linear-gradient(145deg,rgba(255,255,255,.07),rgba(255,255,255,.014)),
    rgba(var(--nexus-custom-panel-rgb),var(--nexus-custom-panel-alpha-strong));
  --nexus-card-glass:rgba(var(--nexus-custom-panel-rgb),var(--nexus-custom-card-alpha));
  --nexus-card-glass-hover:
    linear-gradient(135deg,rgba(var(--nexus-custom-highlight-rgb),var(--nexus-custom-highlight-alpha)),rgba(var(--nexus-custom-panel-rgb),calc(var(--nexus-custom-card-alpha) + .04)));
}

/* Make common highlighted surfaces follow Panel Colour instead of being locked to purple. */
.nav-item:hover,.nav-item.active,
.customize-tab.active,
.customize-choice.active,
.customize-setting-toggle.active,
.search-provider-choice.active,
.customize-wallpaper-card.active,
.customize-colour-choice.active{
  background:linear-gradient(135deg,rgba(var(--nexus-custom-highlight-rgb),var(--nexus-custom-highlight-alpha)),rgba(var(--nexus-custom-panel-rgb),.30)) !important;
}

.customize-space{
  width:min(1180px,78vw) !important;
  height:min(760px,72vh) !important;
  max-height:calc(100vh - 146px) !important;
  overflow:hidden !important;
}

.customize-space-header{
  padding:18px 22px 16px !important;
}

.customize-space-body{
  display:grid !important;
  grid-template-columns:210px minmax(0,1fr) !important;
  gap:0 !important;
  padding:0 !important;
  height:calc(100% - 92px);
  min-height:0;
}

.customize-tabs{
  padding:18px 14px;
  border-right:1px solid rgba(255,255,255,.08);
  background:rgba(4,7,13,.12);
  display:flex;
  flex-direction:column;
  gap:8px;
}

.customize-tab{
  width:100%;
  min-height:48px;
  padding:0 14px;
  border:1px solid transparent;
  border-radius:13px;
  background:transparent;
  color:rgba(238,238,255,.66);
  text-align:left;
  font-weight:720;
  cursor:pointer;
  transition:background .18s ease,border-color .18s ease,color .18s ease,transform .18s ease;
}
.customize-tab:hover,.customize-tab:focus-visible{
  outline:0;
  color:#fff;
  transform:translateY(-1px);
  border-color:var(--nexus-accent-border);
}
.customize-tab.active{
  color:#fff;
  border-color:var(--nexus-accent-border-strong);
  box-shadow:inset 3px 0 0 var(--accent),0 0 22px var(--nexus-accent-soft);
}

.customize-content{
  min-width:0;
  min-height:0;
  overflow:auto;
  padding:22px 24px 28px;
  scrollbar-gutter:stable;
}

.customize-panel[hidden]{display:none !important}
.customize-panel{max-width:820px;margin:0 auto}
.customize-panel>h3{margin:0;font-size:24px;color:#f7f8ff}
.customize-panel>.customize-panel-intro{margin:6px 0 22px;color:rgba(220,220,245,.60);font-size:12px;line-height:1.55}

.customize-section{
  padding:18px;
  margin-bottom:14px;
  border:1px solid var(--nexus-soft-border);
  border-radius:18px;
  background:var(--nexus-card-glass);
}
.customize-section:last-child{margin-bottom:0}
.customize-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:13px}
.customize-section-head h4,.customize-section>h4{margin:0;color:#f3f2ff;font-size:15px}
.customize-section-head p,.customize-section>p{margin:5px 0 0;color:rgba(220,220,245,.55);font-size:10px;line-height:1.5}
.customize-value{flex:0 0 auto;color:color-mix(in srgb,var(--accent) 76%,white);font-size:11px;font-weight:760}

.customize-colour-grid{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:9px;
}
.customize-colour-choice{
  min-width:0;
  height:54px;
  padding:7px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:13px;
  background:rgba(4,7,13,.22);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  color:rgba(238,238,255,.72);
  font-size:9px;
}
.customize-colour-choice:hover,.customize-colour-choice:focus-visible{outline:0;border-color:var(--nexus-accent-border-strong)}
.customize-colour-choice.active{border-color:var(--nexus-accent-border-strong);color:#fff}
.customize-colour-dot{width:22px;height:22px;border-radius:50%;background:var(--choice-colour);box-shadow:0 0 12px color-mix(in srgb,var(--choice-colour) 45%,transparent)}

.customize-custom-colour{display:grid;grid-template-columns:1fr 62px;gap:10px;margin-top:10px;align-items:center}
.customize-custom-colour span{color:rgba(220,220,245,.58);font-size:10px}
.customize-custom-colour input[type="color"]{width:62px;height:34px;padding:2px;border:1px solid rgba(255,255,255,.12);border-radius:10px;background:rgba(4,7,13,.24);cursor:pointer}

.customize-range-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:center}
.customize-range{width:100%;accent-color:var(--accent)}
.customize-range-label{min-width:66px;text-align:right;color:rgba(238,238,255,.72);font-size:10px;font-weight:700}

.customize-wallpaper-current{
  display:grid;
  grid-template-columns:170px minmax(0,1fr) auto;
  gap:14px;
  align-items:center;
  margin-bottom:14px;
}
.customize-wallpaper-preview{
  width:170px;
  aspect-ratio:16/9;
  border-radius:13px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.11);
  background:#080b14 center/cover no-repeat;
}
.customize-wallpaper-copy{min-width:0}
.customize-wallpaper-copy strong{display:block;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.customize-wallpaper-copy small{display:block;margin-top:4px;color:rgba(220,220,245,.52);font-size:9px}
.customize-reset-btn,.customize-secondary-btn{
  min-height:36px;
  padding:0 12px;
  border:1px solid var(--nexus-accent-border);
  border-radius:11px;
  background:rgba(4,7,13,.28);
  color:#f7f8ff;
  font-size:10px;
  font-weight:720;
  cursor:pointer;
}
.customize-reset-btn:hover,.customize-secondary-btn:hover{background:var(--nexus-accent-fill)}

.customize-wallpaper-status{min-height:16px;margin:2px 0 10px;color:rgba(220,220,245,.52);font-size:9px}
.customize-wallpaper-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}
.customize-wallpaper-card{
  padding:0;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  border-radius:13px;
  background:rgba(4,7,13,.22);
  color:#fff;
  cursor:pointer;
  text-align:left;
}
.customize-wallpaper-card:hover,.customize-wallpaper-card:focus-visible{outline:0;border-color:var(--nexus-accent-border-strong)}
.customize-wallpaper-card.active{border-color:var(--nexus-accent-border-strong);box-shadow:0 0 18px var(--nexus-accent-soft)}
.customize-wallpaper-card img{display:block;width:100%;aspect-ratio:16/9;object-fit:cover;background:#080b14}
.customize-wallpaper-card span{display:block;padding:8px 9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:rgba(240,240,255,.82);font-size:9px}
.customize-wallpaper-empty{grid-column:1/-1;padding:20px;text-align:center;border:1px dashed rgba(255,255,255,.10);border-radius:13px;color:rgba(220,220,245,.50);font-size:10px}

.search-provider-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:9px}
.search-provider-choice,.customize-choice{
  min-height:46px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:12px;
  background:rgba(4,7,13,.22);
  color:rgba(240,240,255,.72);
  font-size:10px;
  font-weight:710;
  cursor:pointer;
}
.search-provider-choice:hover,.search-provider-choice:focus-visible,.customize-choice:hover,.customize-choice:focus-visible{outline:0;border-color:var(--nexus-accent-border-strong);color:#fff}
.search-provider-choice.active,.customize-choice.active{border-color:var(--nexus-accent-border-strong);color:#fff}

.customize-choice-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.customize-setting-toggle{
  width:100%;
  min-height:66px;
  padding:12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  text-align:left;
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  background:rgba(4,7,13,.22);
  color:#f4f3ff;
  cursor:pointer;
}
.customize-setting-toggle:hover,.customize-setting-toggle:focus-visible{outline:0;border-color:var(--nexus-accent-border-strong)}
.customize-setting-toggle.active{border-color:var(--nexus-accent-border-strong)}
.customize-setting-toggle b{display:block;font-size:12px}
.customize-setting-toggle small{display:block;margin-top:4px;color:rgba(220,220,245,.53);font-size:9px;line-height:1.45}
.customize-setting-state{flex:0 0 auto;min-width:42px;text-align:center;padding:6px 8px;border-radius:999px;background:rgba(255,255,255,.06);color:rgba(240,240,255,.60);font-size:9px;font-weight:800}
.customize-setting-toggle.active .customize-setting-state{background:var(--nexus-accent-fill);color:#fff}

.customize-ai-warning{
  margin-top:12px;
  padding:12px 13px;
  border:1px solid rgba(255,255,255,.09);
  border-radius:13px;
  background:rgba(4,7,13,.20);
  color:rgba(220,220,245,.57);
  font-size:10px;
  line-height:1.55;
}
.customize-ai-impact{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:12px}
.customize-ai-impact div{padding:11px 12px;border:1px solid rgba(255,255,255,.08);border-radius:12px;background:rgba(4,7,13,.18)}
.customize-ai-impact strong{display:block;font-size:10px}
.customize-ai-impact span{display:block;margin-top:4px;color:rgba(220,220,245,.50);font-size:9px;line-height:1.45}

/* Static sidebar mode: open all the time and remove the drawer handle. */
body.nexus-sidebar-static .sidebar{
  transform:translateX(0) !important;
}
body.nexus-sidebar-static .side-tab{display:none !important}

/* AI off means the interactive AI layer is removed, while the rest of Nexus remains usable. */
body.nexus-ai-disabled #openAiSpace,
body.nexus-ai-disabled #archivesAi,
body.nexus-ai-disabled #gamingAi,
body.nexus-ai-disabled [data-nexus-ai-feature]{display:none !important}

@media(max-width:900px){
  .customize-space{width:min(94vw,900px) !important;height:min(78vh,760px) !important}
  .customize-space-body{grid-template-columns:170px minmax(0,1fr) !important}
  .customize-colour-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .search-provider-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .customize-wallpaper-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:760px){
  .customize-space{
    left:10px !important;
    right:10px !important;
    top:88px !important;
    bottom:10px !important;
    width:auto !important;
    height:auto !important;
    max-height:none !important;
    transform:none !important;
  }
  .customize-space-body{grid-template-columns:1fr !important;height:calc(100% - 92px)}
  .customize-tabs{flex-direction:row;border-right:0;border-bottom:1px solid rgba(255,255,255,.08);padding:10px;overflow:auto}
  .customize-tab{min-width:max-content;width:auto;padding:0 14px}
  .customize-content{padding:16px}
  .customize-wallpaper-current{grid-template-columns:120px minmax(0,1fr);}
  .customize-wallpaper-current .customize-reset-btn{grid-column:1/-1}
  .customize-wallpaper-preview{width:120px}
  .customize-ai-impact{grid-template-columns:1fr}
}

@media(max-width:520px){
  .customize-colour-grid,.search-provider-grid,.customize-wallpaper-grid,.customize-choice-row{grid-template-columns:1fr 1fr}
}

.search-provider-choice{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
}
.search-provider-choice img{
  width:20px;
  height:20px;
  object-fit:contain;
  flex:0 0 20px;
}
