@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #0b0f14;
  --bg2: #101820;
  --card: #121b24;
  --accent: #f7b733;
  --accent2: #5bc0be;
  --text: #eef4f8;
  --muted: #9bb0ba;
  --stroke: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  --sidebar-bg: #210b2c;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: radial-gradient(1000px 600px at 0% -10%, #1a2a36 0%, rgba(11, 15, 20, 0) 70%),
    radial-gradient(900px 500px at 100% 10%, #14303a 0%, rgba(11, 15, 20, 0) 60%),
    var(--bg);
  min-height: 100vh;
}

.bg {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(91, 192, 190, 0.05), transparent 40%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.05'/></svg>");
  pointer-events: none;
  z-index: -1;
}

.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.3s ease;
  overflow: hidden; /* Hide content when collapsed */
}

.sidebar.collapsed {
  width: 80px;
  padding: 24px 12px;
}

.sidebar.collapsed .sidebar-logo, 
.sidebar.collapsed .nav-item {
  justify-content: center;
}

/* Hide text in collapsed mode */
.sidebar.collapsed .nav-item {
  font-size: 0;
}
.sidebar.collapsed .nav-item .icon {
  font-size: 1.5rem;
  margin-right: 0;
}

.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.sidebar-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* App Iframe */
.app-frame {
  width: 100%;
  height: calc(100vh - 73px); /* Minus header height approx */
  border: none;
  background: #fff; /* Most apps have white bg */
}

.sidebar-header {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
}

.sidebar-logo {
  width: 140px;
  height: auto;
  display: block;
  transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-logo {
  opacity: 0; /* Hide full logo, maybe show icon only if available */
  width: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  color: var(--muted);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item .icon {
  font-size: 1.2rem;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-user-info {
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.sidebar.collapsed .sidebar-footer {
  align-items: center;
}
.sidebar.collapsed .sidebar-user-info {
  display: none;
}
.sidebar.collapsed .sidebar-logout span:not(.icon) {
  display: none;
}

/* Login View */
.view-container {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  padding: 40px;
  border-radius: 24px;
  text-align: center;
  max-width: 400px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.login-logo {
  margin-bottom: 0 !important; /* Managed by gap */
}

.login-card h1 {
  margin-top: 0;
  font-size: 1.8rem;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 24px;
}

.btn.large {
  padding: 14px 28px;
  font-size: 1.1rem;
}

/* Ensure footer sticks to bottom of dashboard view */
#dashboard-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative; /* For absolute positioning if needed */
}

.hub-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 44px;
  border-bottom: 1px solid var(--stroke);
  background: transparent; /* Remove background since it's inside main */
}

.hub-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hub-name {
  font-weight: 700;
  font-size: 1.2rem;
}

.hub-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

.hub-container {
  padding: 32px 44px 72px;
  flex: 1;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 26px;
  margin-bottom: 40px;
}

.hero-left h1 {
  font-size: 2.6rem;
  margin: 0 0 12px;
}

.hero-left p {
  color: var(--muted);
  max-width: 560px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.hero-panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-title {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: var(--muted);
}

.panel-list {
  margin: 18px 0;
  display: grid;
  gap: 12px;
}

.panel-footer {
  color: var(--muted);
  font-size: 0.85rem;
}

.section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
}

.section-header p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.badge {
  align-self: flex-start;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(247, 183, 51, 0.4);
  color: var(--accent);
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #f4a340);
  color: #1c1205;
  box-shadow: 0 10px 24px rgba(247, 183, 51, 0.25);
}

.btn.outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

.btn:hover {
  transform: translateY(-2px);
}

.hub-footer {
  padding: 24px 44px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  border-top: 1px solid var(--stroke);
  font-size: 0.9rem;
}

.hub-footer .links {
  display: flex;
  gap: 16px;
}

.hub-footer a {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hub-top,
  .hub-container,
  .hub-footer {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 640px) {
  .layout-wrapper {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }

  .hub-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}