/* ============================================
   CodingBubble IDE Shell - VS Code inspired
   ============================================ */

/* Hide content until shell is ready (prevents header/footer flash) */
body[data-tool] > header,
body[data-tool] > footer {
  display: none !important;
}

/* Shell layout */
#cb-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- Tab Bar ---- */
#cb-tab-bar {
  display: flex;
  align-items: stretch;
  background: #f3f3f3;
  border-bottom: 1px solid #e0e0e0;
  height: 36px;
  min-height: 36px;
  user-select: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#cb-tab-bar::-webkit-scrollbar { display: none; }

.dark #cb-tab-bar {
  background: #252526;
  border-bottom-color: #3c3c3c;
}

.cb-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  cursor: pointer;
  border-right: 1px solid #e0e0e0;
  color: #6b6b6b;
  background: transparent;
  transition: background 0.1s, color 0.1s;
  position: relative;
  min-width: 0;
  flex-shrink: 0;
}
.dark .cb-tab {
  border-right-color: #3c3c3c;
  color: #969696;
}
.cb-tab:hover {
  background: #e8e8e8;
}
.dark .cb-tab:hover {
  background: #2d2d2d;
}
.cb-tab.active {
  color: #333;
  background: #fff;
  border-bottom: 2px solid #007acc;
}
.dark .cb-tab.active {
  color: #fff;
  background: #1e1e1e;
  border-bottom-color: #007acc;
}
.cb-tab-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, 'Courier New', monospace;
}
.cb-tab-close {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
  flex-shrink: 0;
}
.cb-tab:hover .cb-tab-close,
.cb-tab.active .cb-tab-close {
  opacity: 0.6;
}
.cb-tab-close:hover {
  opacity: 1 !important;
  background: rgba(0,0,0,0.1);
}
.dark .cb-tab-close:hover {
  background: rgba(255,255,255,0.1);
}

/* ---- Body (activity bar + content) ---- */
#cb-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ---- Activity Bar ---- */
#cb-activity-bar {
  width: 48px;
  min-width: 48px;
  background: #2c2c2c;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  z-index: 10;
}
#cb-activity-bar::-webkit-scrollbar { display: none; }

.cb-act-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: #858585;
  transition: color 0.15s, background 0.15s;
  position: relative;
  flex-shrink: 0;
}
.cb-act-item:hover {
  color: #ccc;
  background: rgba(255,255,255,0.08);
}
.cb-act-item.active {
  color: #fff;
  background: rgba(255,255,255,0.12);
}
.cb-act-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #fff;
  border-radius: 0 1px 1px 0;
}
.cb-act-icon {
  width: 22px;
  height: 22px;
}
.cb-act-icon svg {
  width: 100%;
  height: 100%;
}
/* Text-based activity icons */
.cb-act-text {
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, 'Courier New', monospace;
  letter-spacing: -0.5px;
}

/* Activity bar bottom items */
.cb-act-spacer { flex: 1; }
.cb-act-bottom {
  border-top: 1px solid #3c3c3c;
  padding-top: 4px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

/* ---- Main Content ---- */
#cb-content {
  flex: 1;
  overflow: auto;
  background: #fff;
  position: relative;
}
.dark #cb-content {
  background: #1e1e1e;
}

/* ---- Status Bar ---- */
#cb-status-bar {
  height: 28px;
  min-height: 28px;
  background: #1b1b1f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  user-select: none;
  gap: 16px;
  z-index: 10;
  border-top: 1px solid #2a2a2e;
}
#cb-status-bar a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
}
#cb-status-bar a:hover {
  color: rgba(255,255,255,0.85);
}
.cb-status-left, .cb-status-right {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}
.cb-status-item {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
  padding: 0 6px;
  border-radius: 4px;
  height: 20px;
  letter-spacing: 0.01em;
}
.cb-status-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
}
.cb-status-item.clickable {
  cursor: pointer;
}
.cb-status-brand {
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
}

/* ---- Command Palette ---- */
#cb-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  display: none;
  justify-content: center;
  padding-top: 15vh;
}
#cb-palette-overlay.open {
  display: flex;
}
#cb-palette {
  width: 520px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  overflow: hidden;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}
.dark #cb-palette {
  background: #252526;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
#cb-palette-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: none;
  outline: none;
  background: transparent;
  color: #333;
  border-bottom: 1px solid #e0e0e0;
}
.dark #cb-palette-input {
  color: #eee;
  border-bottom-color: #3c3c3c;
}
#cb-palette-input::placeholder {
  color: #999;
}
.dark #cb-palette-input::placeholder {
  color: #666;
}
#cb-palette-list {
  overflow-y: auto;
  padding: 4px 0;
  flex: 1;
}
.cb-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  color: #333;
  transition: background 0.08s;
}
.dark .cb-palette-item {
  color: #ccc;
}
.cb-palette-item:hover,
.cb-palette-item.selected {
  background: #e8e8e8;
}
.dark .cb-palette-item:hover,
.dark .cb-palette-item.selected {
  background: #2d2d2d;
}
.cb-palette-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: ui-monospace, 'Courier New', monospace;
  flex-shrink: 0;
  color: #007acc;
}
.cb-palette-item-name {
  flex: 1;
  font-size: 14px;
}
.cb-palette-item-shortcut {
  font-size: 11px;
  color: #999;
  font-family: ui-monospace, monospace;
}

/* ---- Activity bar tooltip ---- */
.cb-tooltip {
  position: absolute;
  left: 52px;
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
}
.cb-act-item:hover .cb-tooltip {
  opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  #cb-activity-bar {
    width: 40px;
    min-width: 40px;
  }
  .cb-act-item {
    width: 34px;
    height: 34px;
  }
  #cb-tab-bar {
    height: 32px;
    min-height: 32px;
  }
  .cb-tab {
    padding: 0 10px;
    font-size: 11px;
  }
}

/* ---- Content area overrides ---- */
/* Override tool pages that set min-h-screen or body padding */
#cb-content .container {
  max-width: 100%;
}

/* Welcome page specific */
.cb-welcome {
  padding: 40px;
  max-width: 960px;
  margin: 0 auto;
}
@media (max-width: 768px) {
  .cb-welcome {
    padding: 20px;
  }
}
.cb-welcome h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.dark .cb-welcome h1 {
  color: #e5e7eb;
}
.cb-welcome .subtitle {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 32px;
}
.dark .cb-welcome .subtitle {
  color: #9ca3af;
}
.cb-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.cb-tool-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
}
.dark .cb-tool-card {
  border-color: #374151;
}
.cb-tool-card:hover {
  border-color: #007acc;
  background: #f0f9ff;
}
.dark .cb-tool-card:hover {
  border-color: #007acc;
  background: rgba(0,122,204,0.08);
}
.cb-tool-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: #fff;
  flex-shrink: 0;
}
.cb-tool-card-info {
  flex: 1;
  min-width: 0;
}
.cb-tool-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 2px;
}
.dark .cb-tool-card-name {
  color: #e5e7eb;
}
.cb-tool-card-desc {
  font-size: 12px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dark .cb-tool-card-desc {
  color: #9ca3af;
}

/* Section headers on welcome */
.cb-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  margin-bottom: 12px;
  padding-left: 4px;
}
.dark .cb-section-title {
  color: #9ca3af;
}

/* Keyboard shortcut hints */
.cb-kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 3px;
  color: #555;
}
.dark .cb-kbd {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: #aaa;
}

/* Quick info section on welcome */
.cb-quick-info {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}
.dark .cb-quick-info {
  border-top-color: #374151;
}
.cb-quick-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
}
.dark .cb-quick-info-item {
  color: #9ca3af;
}
