/* ═══════════════════════════════════════════════
   LOOPSUITE — AI Side Drawer (Neobrutalism)
   ═══════════════════════════════════════════════ */

/* ═══ SPLIT LAYOUT ═══ */
.loop-split-container.drawer-open .loop-split-main {
  flex: 0 0 60%;
}

/* ═══ DIVIDER ═══ */
.loop-split-divider {
  width: 6px; cursor: col-resize;
  background: transparent; transition: background 150ms ease-out;
  flex-shrink: 0; position: relative; display: none;
}
.loop-split-divider::before {
  content: ""; position: absolute;
  top: 0; left: -4px; right: -4px; bottom: 0;
}
.loop-split-divider:hover, .loop-split-divider.dragging {
  background: #FFD60A;
}
.loop-split-container.drawer-open .loop-split-divider { display: block; }

/* ═══ DRAWER PANEL ═══ */
.loop-drawer {
  flex: 1 1 0%; min-width: 280px;
  background: #fff; border: 2px solid #000;
  border-radius: 16px;
  margin: 12px 12px 12px 0;
  box-shadow: 4px 4px 0 #FFD60A;
  display: none; flex-direction: column; overflow: hidden;
  animation: loop-drawer-slide-in 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.loop-split-container.drawer-open .loop-drawer { display: flex; }

@keyframes loop-drawer-slide-in {
  from { opacity: 0; transform: translateX(30px) scale(0.97); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ═══ HEADER ═══ */
.loop-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: none;
  flex-shrink: 0; min-height: 48px;
  background: transparent; position: sticky; top: 0; z-index: 10;
}

.loop-drawer-title {
  font-family: 'Space Mono', monospace; font-weight: 700;
  font-size: 0.85rem; color: #1a1a1a; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.loop-drawer-title-icon { font-size: 1rem; flex-shrink: 0; }

.loop-drawer-close {
  background: #fff; border: 2px solid #000; border-radius: 8px;
  color: #1a1a1a; cursor: pointer; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: 12px;
  font-size: 14px; padding: 0; line-height: 1;
  box-shadow: 2px 2px 0px #000;
  transition: transform 0.1s, box-shadow 0.1s;
}
.loop-drawer-close:hover { transform: translate(-2px,-2px); box-shadow: 4px 4px 0px #000; }
.loop-drawer-close:active { transform: translate(0,0); box-shadow: none; }

/* ═══ CONTENT ═══ */
.loop-drawer-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 16px; color: #525252;
  font-size: 0.88rem; line-height: 1.65;
}
.loop-drawer-content::-webkit-scrollbar { width: 6px; }
.loop-drawer-content::-webkit-scrollbar-track { background: transparent; }
.loop-drawer-content::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ═══ LOADING ═══ */
.loop-drawer-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 48px 24px; gap: 16px; color: #aaa;
}
.loop-drawer-spinner {
  width: 28px; height: 28px;
  border: 3px solid #e5e5e0; border-top-color: #FFD60A;
  border-radius: 50%; animation: loop-drawer-spin 0.7s linear infinite;
}
@keyframes loop-drawer-spin { to { transform: rotate(360deg); } }
.loop-drawer-loading-text {
  font-family: 'Space Mono', monospace; font-size: 0.78rem; color: #aaa;
}

/* ═══ SKELETON LOADING ═══ */
@keyframes loop-skeleton-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 0.3; }
  100% { opacity: 0.6; }
}
.loop-skeleton {
  animation: loop-skeleton-pulse 1.5s ease-in-out infinite;
}
.loop-skeleton-block {
  background: #e5e5e0;
  border-radius: 8px;
  animation: loop-skeleton-pulse 1.5s ease-in-out infinite;
}
.loop-skeleton-line {
  height: 12px;
  background: #e5e5e0;
  border-radius: 6px;
  margin-bottom: 10px;
  animation: loop-skeleton-pulse 1.5s ease-in-out infinite;
}
.loop-skeleton-line:nth-child(odd) { width: 85%; }
.loop-skeleton-line:nth-child(even) { width: 65%; }
.loop-skeleton-circle {
  width: 48px; height: 48px;
  background: #e5e5e0;
  border-radius: 12px;
  animation: loop-skeleton-pulse 1.5s ease-in-out infinite;
}
.loop-skeleton-hero {
  height: 48px; width: 120px;
  background: #e5e5e0;
  border-radius: 10px;
  animation: loop-skeleton-pulse 1.5s ease-in-out infinite;
}
.loop-skeleton-card {
  background: #fafaf7;
  border: 2px solid #e5e5e0;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  animation: loop-skeleton-pulse 1.5s ease-in-out infinite;
}

/* ═══ TYPOGRAPHY ═══ */
.loop-drawer-content h1, .loop-drawer-content h2,
.loop-drawer-content h3, .loop-drawer-content h4 {
  font-family: 'Space Mono', monospace; color: #1a1a1a;
  margin: 20px 0 10px; line-height: 1.3;
}
.loop-drawer-content h1 { font-size: 1.2rem; }
.loop-drawer-content h2 { font-size: 1.05rem; }
.loop-drawer-content h3 { font-size: 0.95rem; }
.loop-drawer-content h4 { font-size: 0.88rem; color: #525252; }
.loop-drawer-content h1:first-child,
.loop-drawer-content h2:first-child,
.loop-drawer-content h3:first-child { margin-top: 0; }
.loop-drawer-content p { margin: 0 0 12px; }
.loop-drawer-content p:last-child { margin-bottom: 0; }
.loop-drawer-content a { color: #1a1a1a; text-decoration: underline; }
.loop-drawer-content strong { color: #1a1a1a; font-weight: 700; }
.loop-drawer-content em { font-style: italic; color: #666; }

.loop-drawer-content code {
  background: #fafaf7; border: 2px solid #000;
  border-radius: 4px; padding: 2px 6px;
  font-family: 'Space Mono', monospace; font-size: 0.82em;
  color: #d63384;
}
.loop-drawer-content pre {
  background: #fafaf7; border: 2px solid #000;
  border-radius: 8px; padding: 14px 16px; margin: 12px 0;
  overflow-x: auto; font-family: 'Space Mono', monospace;
  font-size: 0.78rem; line-height: 1.5; color: #333;
  box-shadow: 2px 2px 0px #000;
}
.loop-drawer-content pre code { background: none; border: none; padding: 0; color: inherit; }
.loop-drawer-content blockquote {
  border-left: 4px solid #FFD60A; padding-left: 14px;
  margin: 12px 0; color: #888; font-style: italic;
}
.loop-drawer-content ul, .loop-drawer-content ol { margin: 10px 0; padding-left: 20px; }
.loop-drawer-content li { margin-bottom: 6px; }
.loop-drawer-content hr { border: none; border-top: 2px solid #000; margin: 20px 0; }

/* ═══ IMAGES ═══ */
.loop-drawer-content img {
  max-width: 100%; height: auto; border-radius: 8px;
  margin: 10px 0; cursor: pointer; display: block;
  border: 2px solid #000; box-shadow: 3px 3px 0px #FFD60A;
  transition: transform 0.1s;
}
.loop-drawer-content img:hover { transform: translate(1px,1px); }

/* ═══ TABLES ═══ */
.loop-drawer-content table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 0.82rem; border: 2px solid #000;
  box-shadow: 3px 3px 0px #000;
}
.loop-drawer-content th {
  text-align: left; font-family: 'Space Mono', monospace;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #1a1a1a;
  padding: 10px 12px; border-bottom: 2px solid #000;
  background: #FFD60A;
}
.loop-drawer-content td {
  padding: 10px 12px; color: #525252;
  border-bottom: 1px solid #e5e5e0; vertical-align: top;
}
.loop-drawer-content tr:hover td { background: rgba(255, 214, 10, 0.06); }

/* ═══ CARDS ═══ */
.loop-drawer-card {
  background: #fff; border: 2px solid #000;
  border-radius: 10px; padding: 16px; margin: 12px 0;
  box-shadow: 3px 3px 0px #FFD60A;
}
.loop-drawer-card-title {
  font-family: 'Space Mono', monospace; font-weight: 700;
  font-size: 0.82rem; color: #1a1a1a; margin-bottom: 8px;
}
.loop-drawer-card-body { font-size: 0.82rem; color: #666; line-height: 1.5; }

/* ═══ FOOTER ═══ */
.loop-drawer-footer {
  padding: 10px 16px; border-top: 1px solid #e5e5e0;
  font-family: 'Space Mono', monospace; font-size: 0.65rem;
  color: #aaa; text-align: center; flex-shrink: 0;
  border-radius: 0 0 14px 14px;
}

/* ═══ CHARTS ═══ */
.loop-chart-wrapper {
  background: #fff; border: 2px solid #000;
  border-radius: 10px; padding: 16px;
  margin: 14px 0;
  box-shadow: 3px 3px 0px #FFD60A;
  position: relative;
  min-height: 200px;
  width: 100%;
}
.loop-chart-wrapper canvas {
  max-height: 320px;
  width: 100% !important;
  height: auto !important;
  display: block;
}

/* ═══ MOBILE ═══ */
@media (max-width: 768px) {
  .loop-split-container.drawer-open .loop-split-main { display: none; }
  .loop-split-container.drawer-open .loop-split-divider { display: none; }
  .loop-split-container.drawer-open .loop-drawer {
    flex: 1 1 100%; min-width: 0; max-width: none;
    margin: 8px; border-radius: 16px;
  }
}
