:root {
  --bg-sidebar: #0f172a;
  --bg-main: #020617;
  --primary: #38bdf8;
  --secondary: #818cf8;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
  --hover: rgba(56, 189, 248, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}

.toggle-sidebar {
  position: fixed;
  left: 305px; /* Aligned with sidebar edge */
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: #0f172a;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1rem;
}

.sidebar.collapsed ~ .toggle-sidebar {
  left: 15px;
  transform: translateY(-50%) rotate(180deg);
}

.sidebar-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
  min-width: 320px; /* Ensure content doesn't wrap during transition */
}

.sidebar-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.project-selector {
  padding: 1.5rem 2rem;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border);
  min-width: 320px;
}

#repo-select {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.8rem;
  background: #1e293b;
  border: 1px solid var(--border);
  color: white;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.file-explorer {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  min-width: 320px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.file-item:hover {
  background: var(--hover);
  color: var(--text);
}

.file-item.active {
  background: var(--hover);
  color: var(--primary);
  font-weight: 600;
}

.badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  background: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 800;
}

.auth-required {
  padding: 1.5rem;
  background: rgba(0,0,0,0.3);
  border-radius: 1rem;
  margin-top: 1rem;
}

.auth-required p {
  font-size: 0.85rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.auth-required input {
  width: 100%;
  padding: 0.6rem;
  background: #000;
  border: 1px solid var(--border);
  color: white;
  border-radius: 0.5rem;
  font-size: 0.8rem;
}

.btn-action {
  background: var(--primary);
  color: #000;
  border: none;
  padding: 0.6rem;
  border-radius: 0.5rem;
  font-weight: 700;
  cursor: pointer;
}

/* Main Viewer */
.main-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
}

.viewer-header {
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}

#file-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: white;
  padding: 0.5rem;
  border-radius: 0.4rem;
  cursor: pointer;
  margin-left: 0.5rem;
}

.btn-icon:hover {
  background: var(--hover);
}

.viewer-content {
  flex: 1;
  position: relative;
  background: white;
}

.welcome-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 80%;
  background: var(--bg-main);
  padding: 3rem;
  border-radius: 2rem;
  border: 1px dashed var(--border);
}

.welcome-screen h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
}

pre {
  margin: 0;
  padding: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: #e2e8f0;
  background: #0f172a;
  height: 100%;
  overflow: auto;
}
