/* Code2Fold - Molecular Studio */
* { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: 'Outfit', sans-serif; }

.glass-panel {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.section-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(100, 116, 139, 0.3), transparent);
}

.btn-primary {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.control-btn {
    padding: 4px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.15s ease;
}

.control-btn:hover { background: rgba(51, 65, 85, 0.8); color: white; }
.control-btn.active { background: linear-gradient(135deg, #06b6d4, #3b82f6); color: white; border: none; }

.example-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 9999px;
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover { background: rgba(6, 182, 212, 0.2); border-color: rgba(6, 182, 212, 0.5); color: #22d3ee; }

.measure-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
    font-size: 8px;
    font-weight: 600;
    border-radius: 4px;
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.15s ease;
}

.measure-btn:hover { background: rgba(51, 65, 85, 0.8); color: white; }
.measure-btn.active { background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(59, 130, 246, 0.3)); color: #22d3ee; border-color: #06b6d4; }

.aa-btn {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    border-radius: 3px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.1s ease;
}

.aa-btn:hover { transform: scale(1.1); z-index: 1; }
.aa-btn.selected { border-color: #f97316; box-shadow: 0 0 8px rgba(249, 115, 22, 0.5); }
.aa-btn.hydrophobic { color: #fbbf24; }
.aa-btn.polar { color: #34d399; }
.aa-btn.positive { color: #60a5fa; }
.aa-btn.negative { color: #f87171; }
.aa-btn.special { color: #c084fc; }

.select-input {
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 10px;
    color: #e2e8f0;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 12px;
}

.feature-card {
    width: 100%;
    padding: 5px 8px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.15s ease;
}

.feature-card:hover { background: rgba(30, 41, 59, 0.7); transform: translateX(2px); }
.icon-box { padding: 3px; border-radius: 3px; }

.toggle-switch {
    width: 28px;
    height: 16px;
    background: #334155;
    border-radius: 9999px;
    position: relative;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.toggle-switch.active { background: linear-gradient(135deg, #10b981, #059669); }

.toggle-dot {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-dot.active { left: calc(100% - 14px); }

.sequence-display { font-family: 'JetBrains Mono', monospace; line-height: 1.6; }

.residue {
    display: inline-block;
    padding: 1px 3px;
    margin: 0.5px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.1s ease;
    font-size: 10px;
    font-weight: 500;
}

.residue:hover { background: rgba(6, 182, 212, 0.3); transform: scale(1.1); }
.residue.highlighted { background: linear-gradient(135deg, #06b6d4, #3b82f6); color: white !important; transform: scale(1.1); }
.residue.neighbor { background: rgba(236, 72, 153, 0.4); }
.residue.mutated { background: rgba(249, 115, 22, 0.4) !important; }
.residue.annotated { box-shadow: 0 0 0 2px #22d3ee; }

.residue.hydrophobic { color: #fbbf24; }
.residue.polar { color: #34d399; }
.residue.positive { color: #60a5fa; }
.residue.negative { color: #f87171; }
.residue.special { color: #c084fc; }

.residue-number { display: inline-block; color: #64748b; font-size: 8px; margin: 0 2px; vertical-align: middle; }

.type-hydrophobic { color: #fbbf24; }
.type-polar { color: #34d399; }
.type-positive { color: #60a5fa; }
.type-negative { color: #f87171; }
.type-special { color: #c084fc; }

.loader-ring {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(6, 182, 212, 0.2);
    border-top-color: #06b6d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.measurement-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-bottom: 4px;
}

.measurement-item:hover { background: rgba(30, 41, 59, 0.7); }

.measurement-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    flex-shrink: 0;
}

.measurement-icon.distance { background: rgba(34, 211, 238, 0.2); color: #22d3ee; }
.measurement-icon.angle { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.measurement-icon.dihedral { background: rgba(168, 85, 247, 0.2); color: #a855f7; }

.measurement-info { flex: 1; min-width: 0; }
.measurement-type { font-size: 8px; font-weight: 700; text-transform: uppercase; color: #64748b; }
.measurement-value { font-size: 10px; font-weight: 600; color: white; font-family: 'JetBrains Mono', monospace; }

.measurement-delete {
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 3px;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s;
}

.measurement-item:hover .measurement-delete { opacity: 1; }
.measurement-delete:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.mutation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 4px;
    font-size: 10px;
}

.mutation-item button { background: none; border: none; color: #64748b; cursor: pointer; padding: 2px; }
.mutation-item button:hover { color: #ef4444; }

.annotation-btn {
    padding: 3px 8px;
    font-size: 9px;
    border-radius: 3px;
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    margin: 2px;
    transition: all 0.15s;
}

.annotation-btn:hover { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
.annotation-btn.active { background: rgba(6, 182, 212, 0.3); color: #22d3ee; border-color: #06b6d4; }

.feature-item {
    padding: 6px 8px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.feature-item:hover { background: rgba(30, 41, 59, 0.7); border-color: rgba(6, 182, 212, 0.3); }

.interaction-item {
    padding: 3px 6px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.interaction-item.hbond { border-left: 2px solid #22c55e; }
.interaction-item.salt { border-left: 2px solid #ef4444; }
.interaction-item.hydrophobic { border-left: 2px solid #eab308; }
.interaction-item.aromatic { border-left: 2px solid #a855f7; }

.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: 2px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.5); border-radius: 2px; }

@keyframes slideIn { from { opacity: 0; transform: translateX(-15px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(15px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.slide-in { animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.slide-in-right { animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.slide-up { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards; }

#toast { transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
#toast.show { transform: translate(-50%, 0); }

body.light-mode { background-color: #f8fafc; }
body.light-mode .glass-panel { background: rgba(255, 255, 255, 0.92); }
body.publication-mode { background-color: #ffffff; }

#sequenceContent.expanded { max-height: 120px !important; }
#seqToggleIcon.rotated { transform: rotate(180deg); }

::selection { background: rgba(6, 182, 212, 0.3); }

/* Minimal left nav + panel layout */
.left-nav{
  position:fixed;
  left:12px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:10px;
  background:rgba(15,23,42,.65);
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  z-index:60;
  backdrop-filter: blur(10px);
}
.nav-btn{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(17,28,51,.65);
  color:rgba(148,163,184,1);
  display:grid;
  place-items:center;
  cursor:pointer;
  transition: transform .08s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-btn:hover{transform:translateY(-1px); color:rgba(229,231,235,1);}
.nav-btn.is-active{
  color:rgb(34,211,238);
  border-color:rgba(34,211,238,.35);
  background:rgba(34,211,238,.10);
}
.nav-btn svg{width:18px;height:18px}
.control-panel{
  position:fixed;
  left:72px;
  top:16px;
  bottom:16px;
  width:320px;
  background:rgba(15,23,42,.70);
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  z-index:55;
  padding:12px;
  overflow:auto;
  backdrop-filter: blur(10px);
}
.section{display:flex; flex-direction:column; gap:10px;}

/* Hide left nav while welcome screen is visible (no flicker) */
body.welcome-open #leftNav{display:none !important;}



/* FIX: prevent left icon nav overlapping control panel */
#leftNav{
  width: 56px;
  padding: 10px;
  z-index: 60;
}
#controlPanel{
  left: 78px !important; /* 12px left margin + ~56px nav + 20px gap */
  z-index: 55;
}
@media (max-width: 900px){
  #controlPanel{
    left: 66px !important;
    width: calc(100% - 82px);
    max-width: 420px;
  }
}



/* Keep viewport unobstructed by left UI on large screens */
#viewport{
  position: absolute;
  inset: 0;
}
