/* BDB Platform Design System v2.0 - Global stylesheet for integrated apps */

:root {
  --bdb-color-primary: #311F15;
  --bdb-color-accent: #E89E79;
  --bdb-color-success: #38914E;
  --bdb-color-background: #F5F4F3;
  --bdb-color-sidebar-bg-start: #3D2E28;
  --bdb-color-sidebar-bg-end: #2A1E1A;
  --bdb-color-sidebar-text: rgba(255, 255, 255, 0.6);
  --bdb-color-sidebar-text-hover: rgba(255, 255, 255, 0.85);
  --bdb-color-sidebar-text-active: #FFFFFF;
  --bdb-color-sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --bdb-color-sidebar-active-bg: rgba(255, 255, 255, 0.1);
  --bdb-color-border: #E3E1DE;
  --bdb-font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bdb-appbar-width: 64px;
}

.bdb-platform-shell {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
  font-family: var(--bdb-font-family);
}

.bdb-main-content {
  flex: 1 1 auto;
  background: var(--bdb-color-background);
  padding: 32px;
  overflow-y: auto;
  min-height: 0;
  min-width: 0;
}

/* ===== Platform AppBar — Vertical Left Sidebar ===== */

.bdb-appbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--bdb-appbar-width);
  height: 100vh;
  background: #1F1714;
  z-index: 50;
  flex-shrink: 0;
  font-family: var(--bdb-font-family);
  position: fixed;
  left: 0;
  top: 0;
}

.bdb-appbar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 64px;
  border-bottom: 1px solid #3D2E28;
  flex-shrink: 0;
}

.bdb-appbar-logo a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  transition: background 0.15s;
  text-decoration: none;
}

.bdb-appbar-logo a:hover {
  background: rgba(255, 255, 255, 0.06);
}

.bdb-appbar-logo img,
.bdb-appbar-logo svg {
  width: 32px;
  height: 32px;
}

.bdb-appbar-apps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  padding: 16px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #4A3830 transparent;
  width: 100%;
  align-items: center;
}

.bdb-appbar-apps::-webkit-scrollbar {
  width: 4px;
}

.bdb-appbar-apps::-webkit-scrollbar-track {
  background: transparent;
}

.bdb-appbar-apps::-webkit-scrollbar-thumb {
  background: #4A3830;
  border-radius: 2px;
}

.bdb-appbar-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 9px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: transparent;
  font-family: var(--bdb-font-family);
  position: relative;
  letter-spacing: 0.02em;
  gap: 2px;
  flex-shrink: 0;
}

.bdb-appbar-app:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

.bdb-appbar-app.active {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.bdb-appbar-app.active .bdb-appbar-app-icon svg {
  color: var(--bdb-color-accent);
}

.bdb-appbar-app.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--bdb-color-accent);
  border-radius: 0 2px 2px 0;
}

.bdb-appbar-app-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bdb-appbar-app svg,
.bdb-appbar-app img {
  width: 22px;
  height: 22px;
}

.bdb-appbar-app-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-top: 1px;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bdb-appbar-divider {
  height: 1px;
  background: #3D2E28;
  margin: 8px 4px;
  width: calc(100% - 16px);
  flex-shrink: 0;
}

.bdb-appbar-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-top: 1px solid #3D2E28;
  flex-shrink: 0;
  width: 100%;
}

.bdb-appbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bdb-color-success);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s;
}

.bdb-appbar-avatar:hover {
  transform: scale(1.05);
}

.bdb-appbar-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.bdb-appbar-notification {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.bdb-appbar-notification:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

.bdb-appbar-notification svg {
  width: 20px;
  height: 20px;
}

.bdb-appbar-notification {
  position: relative;
}

.bdb-notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  border: 2px solid #1F1714;
  pointer-events: none;
}

.bdb-notif-panel {
  position: absolute;
  left: calc(100% + 8px);
  bottom: 0;
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--bdb-color-border, #E3E1DE);
  width: 360px;
  z-index: 100;
  overflow: hidden;
  font-family: var(--bdb-font-family, 'Barlow', sans-serif);
}

/* ===== User Dropdown ===== */

.bdb-user-dropdown {
  position: absolute;
  left: calc(100% + 8px);
  bottom: 0;
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--bdb-color-border);
  min-width: 200px;
  z-index: 100;
  overflow: hidden;
  font-family: var(--bdb-font-family);
}

.bdb-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--bdb-color-primary);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font-family: var(--bdb-font-family);
}

.bdb-user-dropdown-item:hover {
  background: rgba(49, 31, 21, 0.04);
}

.bdb-user-dropdown-divider {
  height: 1px;
  background: var(--bdb-color-border);
  margin: 4px 0;
}

/* ===== App Sidebar (per-app navigation) ===== */

.bdb-app-sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--bdb-color-sidebar-bg-start) 0%, var(--bdb-color-sidebar-bg-end) 100%);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--bdb-font-family);
}


.bdb-app-sidebar-header {
  height: 64px;
  min-height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.bdb-app-sidebar-header-title {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  font-family: var(--bdb-font-family);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.bdb-app-sidebar-header-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--bdb-font-family);
  margin-top: 2px;
}

.bdb-app-sidebar-content {
  flex: 1;
  padding: 12px 12px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #4A3830 transparent;
}

.bdb-app-sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.bdb-app-sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.bdb-app-sidebar-content::-webkit-scrollbar-thumb {
  background: #4A3830;
  border-radius: 3px;
}

.bdb-app-sidebar-content::-webkit-scrollbar-thumb:hover {
  background: #5C473D;
}

.bdb-sidebar-section {
  margin-bottom: 8px;
}

.bdb-sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  padding: 8px 20px 4px;
  font-family: var(--bdb-font-family);
}

.bdb-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-radius: 8px;
  color: var(--bdb-color-sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--bdb-font-family);
}

.bdb-sidebar-link:hover {
  background: var(--bdb-color-sidebar-hover-bg);
  color: var(--bdb-color-sidebar-text-hover);
}

.bdb-sidebar-link.bdb-sidebar-active {
  background: var(--bdb-color-sidebar-active-bg);
  color: var(--bdb-color-sidebar-text-active);
}

.bdb-sidebar-link.bdb-sidebar-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--bdb-color-accent);
  border-radius: 0 2px 2px 0;
}

.bdb-sidebar-link svg,
.bdb-sidebar-link img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ===== Utility Classes ===== */

.bdb-card {
  background: #FFFFFF;
  border-radius: 8px;
  border: 1px solid var(--bdb-color-border);
  padding: 24px;
}

.bdb-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--bdb-color-success);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: var(--bdb-font-family);
  text-decoration: none;
}

.bdb-btn-primary:hover {
  background: #2f7d42;
}

.bdb-btn-primary:active {
  transform: scale(0.98);
}

.bdb-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: transparent;
  color: var(--bdb-color-primary);
  border: 1px solid var(--bdb-color-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: var(--bdb-font-family);
  text-decoration: none;
}

.bdb-btn-outline:hover {
  background: rgba(49, 31, 21, 0.04);
  border-color: rgba(49, 31, 21, 0.2);
}

.bdb-text-primary {
  color: var(--bdb-color-primary);
}

.bdb-text-muted {
  color: #888888;
}

/* ===== Layout helper: push content right of the fixed appbar ===== */

.bdb-content-wrapper {
  margin-left: var(--bdb-appbar-width);
  display: flex;
  height: 100vh;
  width: calc(100% - var(--bdb-appbar-width));
}

/* ===== Responsive: Mobile ===== */

@media (max-width: 768px) {
  .bdb-appbar {
    display: none;
  }

  .bdb-content-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .bdb-app-sidebar {
    display: none;
  }

  .bdb-app-sidebar.bdb-sidebar-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
  }

  .bdb-main-content {
    padding: 16px;
  }
}
