:root{
  --bg:#0b1220;
  --panel:#0f1a2f;
  --panel2:#101c33;
  --border:#22304d;
  --text:#e7ebf3;
  --muted:#a9b3c7;
  --accent:#6fb7ff;
  --accent2:#4aa3ff;
  --danger:#ff5d6c;
  --shadow: 0 14px 40px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 40% -20%, #1b2c52 0%, var(--bg) 60%);
  color:var(--text);
}

/* ===== Navbar ===== */
.site-header{
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom:1px solid rgba(34,48,77,.7);
  background: rgba(11,18,32,.8);
  backdrop-filter: blur(10px);
}

.navbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 16px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--text);
  text-decoration:none;
}
.logo{
  width:36px;height:36px;border-radius:10px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, var(--accent2), #7c5cff);
  font-weight:900;
  box-shadow: var(--shadow);
}
.brand-text{ display:flex; flex-direction:column; line-height:1.1; }
.brand-text small{ color:var(--muted); font-weight:500; margin-top:2px; }

.nav-links{
  display:flex;
  gap:14px;
  flex-wrap:wrap;
}
.nav-links a{
  color:var(--muted);
  text-decoration:none;
  font-weight:600;
  padding:8px 10px;
  border-radius:10px;
}
.nav-links a:hover{
  color:var(--text);
  background: rgba(255,255,255,.05);
}
.nav-links a.active{
  color:var(--accent);
  background: rgba(111, 183, 255, 0.1);
  font-weight: 700;
}



/* ===== Layout ===== */
.layout{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:14px;
  padding:14px;
  height: calc(100vh - 70px);
}

.panel{
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow: var(--shadow);
  padding:0;

  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 12px;
}

.panel-fixed {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  background: rgba(16,28,51,.35);
  padding: 12px;
}

.panel-section{
  padding:10px;
  border-radius:12px;
  background: rgba(16,28,51,.55);
  border:1px solid rgba(34,48,77,.7);
}
.panel-section + .panel-section{ margin-top:10px; }
.panel-title{ font-weight:900; margin:0; }
.panel-title-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
}

.file-btn-sidebar{
  cursor:pointer;
  border:1px solid var(--accent2);
  background: rgba(74, 163, 255, 0.15);
  color: var(--accent2);
  padding:4px 10px;
  border-radius:8px;
  font-weight:700;
  font-size:12px;
  transition: background .2s;
}
.file-btn-sidebar:hover{
  background: rgba(74, 163, 255, 0.25);
}
.file-btn-sidebar input{ display:none; }

.clips{ display:flex; flex-direction:column; gap:8px; }
.clip{
  padding:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background: rgba(255,255,255,.03);
  cursor:pointer;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.clip.active{
  border-color: rgba(111,183,255,.8);
  box-shadow: 0 0 0 3px rgba(111,183,255,.12);
}
.clip small{ color:var(--muted); display:block; margin-top:2px; }
.clip .dot{ width:10px;height:10px;border-radius:99px; background: var(--accent); opacity:.8; }

.row{ display:flex; gap:10px; }
.row.small{ margin-top:10px; }

.btn{
  flex:1;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.05);
  color:var(--text);
  cursor:pointer;
  transition: transform .05s ease, background .2s ease;
  font-weight:800;
}
.btn:hover{ background: rgba(255,255,255,.07); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity:.45; cursor:not-allowed; }
.btn.primary{
  background: linear-gradient(135deg, var(--accent2), #7c5cff);
  border-color: transparent;
}
.btn.danger{
  border-color: rgba(255,93,108,.35);
  background: rgba(255,93,108,.07);
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.field{ display:grid; gap:8px; margin-top:10px; }
.field-top{ display:flex; justify-content:space-between; align-items:center; color:var(--muted); }

.pill{
  flex:1;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  border-radius:12px;
  padding:8px 10px;
  display:flex;
  justify-content:space-between;
  color:var(--muted);
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color:var(--text);
}

.hint{
  margin:10px 0 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.select{
  width:100%;
  padding:10px 12px;
  padding-right: 32px; /* Space for arrow */
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline: none;
  font-weight:700;
  
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  
  cursor: pointer;
  
  /* Custom Arrow SVG */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238899ac' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  
  transition: border-color .2s, background-color .2s;
}

.select:hover:not(:disabled){
  background-color: rgba(255,255,255,.08);
  border-color: var(--accent2);
}

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

.select:disabled{ 
  opacity:.45; 
  cursor: not-allowed;
}

/* Fix option color in some browsers */
.select option {
  background: #1e1e24; /* Fallback dark */
  color: var(--text);
}

/* ===== Workspace ===== */
.workspace{
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow: var(--shadow);
  overflow:hidden;

  height: 100%;
  display:flex;
  flex-direction: column;
}

.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background: rgba(16,28,51,.55);
}
.badge{
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  padding:8px 10px;
  border-radius:999px;
  color:var(--muted);
  max-width: 70ch;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zoom{ display:flex; align-items:center; gap:10px; color:var(--muted); }
.zoom input{ width:220px; }

.wavewrap{
  padding:10px;
  background: #0c1426;
  flex: 1;
  overflow: hidden;
}

canvas{
  width:100%;
  display:block;
  border-radius:12px;
  border:1px solid rgba(34,48,77,.8);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.00));
  touch-action: none; /* important for pointer drag on mobile */
}
#wave{ height:360px; margin-top:10px; }
#timeline{ height:56px; }

.scroll-container{
  height: 16px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border);
}
#scroll-spacer{
  height: 1px;
}

/* ===== Content sections (FAQ etc.) ===== */
.content-section{
  padding: 18px 14px 40px;
}
.content-card{
  max-width: 1100px;
  margin: 0 auto;
  border: 1px solid rgba(34,48,77,.7);
  background: rgba(16,28,51,.45);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.content-card h2{ margin: 0 0 14px; }
details{
  border:1px solid rgba(34,48,77,.7);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.03);
}
details + details{ margin-top: 10px; }
summary{
  cursor:pointer;
  font-weight: 800;
}
details p{ color: var(--muted); margin: 10px 0 0; }

.site-footer{
  border-top:1px solid rgba(34,48,77,.7);
  background: rgba(11,18,32,.8);
  backdrop-filter: blur(10px);
  padding: 18px 14px;
}
.footer-inner{
  max-width: 1100px;
  margin: 0 auto;
  display:flex;
  gap: 20px;
  align-items:flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.footer-links{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-links a{
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}
.footer-links a:hover{ color: var(--text); }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }

/* ===== Responsive ===== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Blog Enhancements ===== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-top: 30px;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.blog-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.blog-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.1em;
}

.blog-card h3 {
  font-size: 20px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.blog-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 20px;
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.blog-meta .dot {
  width: 4px;
  height: 4px;
  background: var(--border);
  border-radius: 50%;
}

.article-header {
  margin-bottom: 40px;
}

.article-header h1 {
  font-size: 42px;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 30px;
}

.article-body {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-muted);
}

.article-body p { margin-bottom: 24px; }
.article-body h2 { margin: 40px 0 16px; font-size: 28px; }
.article-body ul { margin-bottom: 24px; padding-left: 20px; }
.article-body li { margin-bottom: 12px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  margin-bottom: 30px;
}

@media (max-width: 980px){
  .nav-links{ display:none; }
  .layout{
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 70px);
  }
  .panel{
    max-height: 42vh;
  }
  .workspace{
    min-height: 55vh;
    height: auto;
  }
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Loader Overlay ===== */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 14, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.loader-content h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 20px 0 8px;
  color: var(--text);
}

.loader-content p {
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(111, 183, 255, 0.1);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
