/* ============================================================================
   LUMIQ STUDIO — UI COMPONENTS (Polished)
   ============================================================================ */

/* ---- API Key Overlay ---- */
.apikey-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
}

.apikey-inner {
  background: var(--bg2);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  border: 1px solid var(--border-hi);
  box-shadow: var(--shadow-lg);
}

/* ---- Upload Slots ---- */
.isl {
  aspect-ratio: 1;
  width: 100%;
  max-width: 120px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  overflow: hidden;
  color: rgba(255, 255, 255, 0.5);
  min-height: unset;
  min-width: unset;
  box-sizing: border-box;
}

.upload-slot-with-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-grid .isl {
  max-width: unset;
}

.isl span {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.isl small {
  color: rgba(255, 255, 255, 0.2);
  font-size: 9px;
}

.isl:hover {
  background: rgba(155, 21, 21, 0.06);
  border-color: rgba(155,21,21,0.3);
  border-style: dashed;
  box-shadow: 0 0 16px rgba(155,21,21,0.08);
}

.isl.has-image {
  background-size: cover;
  background-position: center;
  border-style: solid;
}

.isl img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--radius-md) - 1px);
}

.isl-plus {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(155,21,21,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: rgba(155,21,21,0.6);
  margin-bottom: 6px;
  transition: all 0.2s var(--ease);
}

.isl:hover .isl-plus {
  background: rgba(155,21,21,0.25);
  color: rgba(155,21,21,0.9);
}

.isl-lbl {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  text-align: center;
  letter-spacing: 0.5px;
}

.isl-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(129, 0, 0, 0.85);
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
}

.isl-star {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.isl:hover .isl-star {
  opacity: 1;
}

.upload-slot {
  aspect-ratio: unset;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  color: white;
  transition: all 0.25s var(--ease);
  overflow: hidden;
  position: relative;
  min-height: 60px;
  min-width: 60px;
}

.upload-slot:hover {
  border-color: rgba(155,21,21,0.3);
  background: rgba(155,21,21,0.06);
}

.upload-slot.large {
  aspect-ratio: 1;
  min-height: unset;
}

.upload-slot-with-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-with-notes,
.upload-with-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-with-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-with-hex {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- Input Groups ---- */
.ig {
  margin-bottom: 12px;
}

.ig:last-child {
  margin-bottom: 0;
}

.il {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-sec);
  margin-bottom: 8px;
  letter-spacing: 0.8px;
}

.il::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.4;
}

/* ---- Text Inputs, Textareas, Selects ---- */
.ti,
.ta,
.sel {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 14px;
  transition: all 0.2s var(--ease);
}

.ti::placeholder,
.ta::placeholder {
  color: var(--text-ter);
}

.ti:focus,
.ta:focus,
.sel:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg4);
  box-shadow: 0 0 0 3px rgba(155,21,21,0.12);
}

.ta {
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
  font-family: var(--mono);
  font-size: 12px;
}

.sel {
  cursor: pointer;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(248,246,242,0.4)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.sel::-ms-expand {
  display: none;
}

.text-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--sans);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: all 0.2s var(--ease);
  box-sizing: border-box;
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155,21,21,0.12);
}

.text-input::placeholder {
  color: var(--text-ter);
}

.hex-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--mono);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: all 0.2s var(--ease);
  box-sizing: border-box;
}

.hex-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155,21,21,0.12);
}

.hex-input::placeholder {
  color: var(--text-ter);
}

.instructions-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--sans);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
  transition: all 0.2s var(--ease);
  line-height: 1.5;
}

.instructions-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155,21,21,0.12);
}

.instructions-input::placeholder {
  color: var(--text-ter);
}

.small-note {
  width: 100%;
  padding: 4px 8px;
  font-size: 10px;
  font-family: var(--sans);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-sec);
  outline: none;
  resize: none;
  min-height: 22px;
  max-height: 32px;
  box-sizing: border-box;
  line-height: 1.3;
  transition: border-color 0.2s var(--ease);
}

.small-note:focus {
  border-color: var(--accent);
}

.small-note::placeholder {
  color: var(--text-ter);
}

.note-text {
  font-size: 10px;
  color: var(--text-ter);
  margin: 2px 0 0;
  line-height: 1.4;
}

.info-box {
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-sec);
  line-height: 1.6;
}

.info-text {
  font-size: 12px;
  color: var(--text-sec);
  line-height: 1.6;
}

.required {
  font-size: 10px;
  color: var(--red);
  font-weight: 400;
  margin-left: 4px;
}

.optional {
  font-size: 10px;
  color: var(--text-ter);
  font-weight: 400;
  margin-left: 4px;
}

.inp-div {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

/* ---- Pills ---- */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sec);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--border-hi);
  color: var(--text);
  transform: translateY(-1px);
}

.pill.on {
  background: var(--accent);
  border-color: var(--accent-hi);
  color: white;
  box-shadow: var(--shadow-glow);
}

.pill-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-sec);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.pill-btn:hover {
  background: var(--bg4);
  color: var(--text);
  transform: translateY(-1px);
}

.pill-btn.active,
.pill-btn.on {
  background: var(--accent);
  border-color: var(--accent-hi);
  color: white;
  box-shadow: var(--shadow-glow);
}

.toggle-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.star-btn {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-ter);
  transition: all 0.2s var(--ease);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  color: var(--amber);
  transform: scale(1.15);
}

.star-btn.active,
.star-btn.hero {
  color: var(--amber);
}

.isl .star-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 4;
  font-size: 14px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  backdrop-filter: blur(4px);
}

/* ---- Collapsible Sections ---- */
.coll-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
  transition: color 0.2s var(--ease);
}

.coll-hdr:hover {
  color: var(--text);
}

.coll-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 10px;
  transition: transform 0.2s var(--ease);
  color: var(--text-ter);
}

.coll-hdr.collapsed .coll-arrow {
  transform: rotate(-90deg);
}

.coll-body {
  overflow: hidden;
  max-height: 1000px;
  transition: max-height 0.3s var(--ease);
}

.coll-body.collapsed {
  max-height: 0;
}

.collapsible-section {
  margin-bottom: 8px;
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
  color: var(--text-sec);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.2s var(--ease);
}

.collapsible-header:hover {
  color: var(--text);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s var(--ease);
}

/* ---- Generation Bar ---- */
.gen-bar {
  position: fixed;
  bottom: 0;
  left: 240px;
  right: 340px;
  background: rgba(10,10,12,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 20px;
  gap: 8px 16px;
  z-index: 100;
}

.gen-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gen-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-ter);
  letter-spacing: 0.8px;
  min-width: 50px;
}

.gen-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.gen-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  flex: 1;
}

.eng-tog,
.res-tog {
  display: flex;
  gap: 4px;
}

.tog-opt {
  padding: 6px 13px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.tog-opt.on {
  background: var(--accent);
  border-color: var(--accent-hi);
  color: white;
  box-shadow: var(--shadow-glow);
}

.tog-opt:hover:not(.on) {
  border-color: var(--border-hi);
  color: var(--text);
  background: var(--bg4);
}

.rat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---- Generate Button ---- */
.btn-generate {
  margin-left: auto;
  padding: 11px 28px;
  background: linear-gradient(135deg, #9B1515 0%, #B52020 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  letter-spacing: 0.8px;
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(155,21,21,0.4);
}

.btn-generate:hover::before {
  opacity: 1;
}

.btn-generate:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(155,21,21,0.3);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Generating state animation */
.btn-generate.generating {
  background: linear-gradient(270deg, #9B1515, #5a0808, #9B1515);
  background-size: 200% 100%;
  animation: genGradient 2s ease infinite;
}

@keyframes genGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.qty-input {
  width: 60px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: var(--mono);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  text-align: center;
  transition: border-color 0.2s var(--ease);
}

.qty-input:focus {
  border-color: var(--accent);
}

select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 14px;
  cursor: pointer;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(248,246,242,0.4)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  outline: none;
  transition: all 0.2s var(--ease);
}

select:focus {
  border-color: var(--accent);
  background-color: var(--bg4);
  box-shadow: 0 0 0 3px rgba(155,21,21,0.12);
}

select::-ms-expand {
  display: none;
}

.credit-cost-hidden { display: none; }

/* ---- AI Assist Tips ---- */
.ai-tip{position:fixed;bottom:80px;right:24px;z-index:9500;padding:10px 16px;border-radius:8px;font-family:'JetBrains Mono',monospace;font-size:.75rem;max-width:400px;cursor:pointer;transition:opacity .3s;box-shadow:0 4px 20px rgba(0,0,0,.4);line-height:1.4}
.ai-tip-icon{margin-right:6px;font-size:.85rem}
.ai-tip-success{background:rgba(40,120,60,.95);color:#e0f5e0;border:1px solid rgba(60,180,80,.3)}
.ai-tip-warning{background:rgba(160,120,20,.95);color:#fff5d0;border:1px solid rgba(200,160,40,.3)}
.ai-tip-error{background:rgba(160,40,40,.95);color:#ffe0e0;border:1px solid rgba(200,60,60,.3)}
.ai-tip-info{background:rgba(30,30,35,.95);color:rgba(248,246,242,.85);border:1px solid rgba(200,80,80,.3)}
.ai-enhance-btn{background:none;border:1px solid rgba(200,80,80,.4);color:#C85050;font-size:.65rem;padding:2px 8px;border-radius:4px;cursor:pointer;font-family:'JetBrains Mono',monospace;margin-left:8px;transition:all .2s}
.ai-enhance-btn:hover{background:rgba(200,80,80,.15);border-color:#C85050}
.ai-enhance-btn:disabled{opacity:.5;cursor:wait}

/* ---- Profile Popup ---- */
.profile-popup {
  position: fixed;
  bottom: 108px;
  left: 8px;
  width: 224px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  transform: translateY(8px);
}
.profile-popup.pop-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.profile-popup-card {
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.profile-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.profile-popup-info { flex: 1; min-width: 0; }
.profile-popup-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-popup-plan { font-size: 11px; color: var(--text-sec); margin-top: 2px; }
.profile-nav-list { padding: 8px 0; }
.profile-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.profile-nav-item:hover { background: var(--bg3); }
.profile-nav-divider {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-sec);
  padding: 10px 20px 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.profile-signout { color: var(--accent); margin-top: 4px; }
