/* =========================================================
   style_database_foundation.css
   Style đặc thù của trang Database Foundation.
   Load sau common.css.
   Chỉ chứa: (1) override giá trị khác common gốc,
             (2) additions không có trong common gốc.
========================================================= */

/* =========================================================
   TOP HEADER OVERRIDES
========================================================= */

.top-header {
  padding: 0 32px;
  backdrop-filter: blur(10px);
  z-index: 50;
}

/* =========================================================
   BRAND OVERRIDES
========================================================= */

.brand-logo {
  width: 48px;
  border-radius: 10px;
}

.brand-text {
  line-height: 1.2;
}

.brand-text strong {
  font-weight: 800;
}

/* =========================================================
   HEADER SEARCH OVERRIDES
========================================================= */

.header-search input {
  width: min(420px, 100%);
  height: 38px;
  background: #fff;
  color: var(--text);
}

/* =========================================================
   HEADER ACTIONS OVERRIDES
========================================================= */

.header-actions button {
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
  font-weight: 600;
}

.header-actions .sign-in-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 800;
}

/* =========================================================
   MAIN NAV OVERRIDES
========================================================= */

.main-nav {
  padding-left: 72px;
  color: #fff;
  z-index: 45;
}

/* =========================================================
   NAV ITEM OVERRIDES
========================================================= */

.nav-item {
  padding: 0 22px;
  align-items: center;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.16);
}

.nav-arrow {
  margin-left: 6px;
  font-size: 12px;
}

/* =========================================================
   NAV DROPDOWN OVERRIDES
========================================================= */

.nav-dropdown {
  width: 290px;
  min-width: unset;
  max-width: unset;
  background: #fff;
  border-radius: 0 0 14px 14px;
  color: var(--text);
}

.nav-item:hover .nav-dropdown {
  display: block;
}

.dropdown-item {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 13px 16px;
}

.dropdown-item:hover,
.dropdown-item.active {
  color: var(--primary);
  font-weight: 800;
}

.dropdown-item small {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 400;
}

/* =========================================================
   SIDEBAR OVERRIDES
========================================================= */

.left-sidebar {
  height: calc(100vh - var(--fixed-header-height));
  min-height: 0;
  overflow-x: hidden;
  padding: 18px 0;
}

.sidebar-title {
  font-size: 22px;
  padding: 0 18px 14px;
  font-weight: 800;
}

.sidebar-section-label {
  padding: 10px 18px 6px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.sidebar-link {
  padding: 9px 18px;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-link.active {
  color: #fff;
}

/* =========================================================
   APP LAYOUT OVERRIDES
========================================================= */

.app-layout {
  min-height: 0;
}

/* =========================================================
   CONTENT OVERRIDES
========================================================= */

.content {
  min-width: 0;
  min-height: 0;
  height: calc(100vh - var(--fixed-header-height));
  background: transparent;
}

.content-inner {
  width: min(100%, 1320px);
  max-width: 1320px;
}

.lesson-header-wrapper {
  position: relative;
}

.lesson-header-inner {
  padding-top: 16px;
  padding-bottom: 16px;
}

.lesson-breadcrumb {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.lesson-top {
  gap: 24px;
}

.lesson-label {
  font-weight: 800;
  margin-bottom: 6px;
}

h1 {
  margin: 0;
  color: var(--primary);
  font-size: clamp(30px, 2.4vw, 42px);
  font-weight: 500;
  line-height: 1.15;
}

.bookmark-btn {
  width: 40px;
  height: 40px;
  margin-top: 18px;
  font-size: 32px;
}

/* =========================================================
   LESSON NAV OVERRIDES
========================================================= */

.lesson-nav {
  align-items: center;
  padding-top: 8px;
}

.lesson-nav button {
  min-width: 112px;
  height: 38px;
  background: #fff;
  padding: 0 16px;
  box-shadow: 0 4px 14px rgba(0, 36, 107, 0.06);
}

.lesson-nav button:hover:not(:disabled) {
  color: #fff;
}

.lesson-nav button:disabled {
  background: #F2F6FF;
  color: #9AAAC4;
  border-color: #E0E8F6;
  box-shadow: none;
}

/* =========================================================
   CONTENT BODY OVERRIDES
========================================================= */

.content-body {
  min-height: 0;
  overflow-x: hidden;
}

/* =========================================================
   LESSON BLOCK OVERRIDES
========================================================= */

.lesson-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.lesson-block h2 {
  color: var(--primary);
  font-size: 30px;
  font-weight: 500;
}

/* =========================================================
   RIGHT SIDEBAR OVERRIDES
========================================================= */

.right-sidebar {
  height: calc(100vh - var(--fixed-header-height));
  min-height: 0;
  overflow-x: hidden;
}

.info-card {
  background: #fff;
  border-radius: 12px;
}

.info-card h3 {
  margin-top: 0;
  color: var(--primary);
  font-size: 18px;
}

/* =========================================================
   SCROLLBAR OVERRIDES
========================================================= */

.left-sidebar::-webkit-scrollbar,
.right-sidebar::-webkit-scrollbar {
  width: 6px;
}

.content-body::-webkit-scrollbar {
  width: 8px;
}

.left-sidebar::-webkit-scrollbar-track,
.right-sidebar::-webkit-scrollbar-track,
.content-body::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   DB FOUNDATION SPECIFIC — additions
========================================================= */

.concept-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.concept-card {
  background: #F8FBFF;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.concept-card h3 {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 18px;
}

.db-hierarchy {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0;
}

.db-hierarchy span {
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
}

.relationship-flow {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  gap: 16px;
  align-items: center;
  margin: 24px 0;
}

.relationship-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.relationship-arrow {
  color: var(--primary);
  font-size: 28px;
  font-weight: 900;
  text-align: center;
}

.grain-table td:first-child {
  font-weight: 800;
  color: var(--primary);
}

.null-warning {
  background: #FFF8EB;
  border-left: 5px solid var(--warning);
  border-radius: 12px;
  padding: 18px 20px;
  font-weight: 700;
}

/* =========================================================
   RESPONSIVE — DB FOUNDATION SPECIFIC
========================================================= */

/* =========================================================
   RESPONSIVE — DB FOUNDATION SPECIFIC
========================================================= */

@supports (height: 100dvh) {
  .left-sidebar,
  .content,
  .right-sidebar {
    height: calc(100dvh - var(--fixed-header-height));
  }
}

@media (min-width: 1600px) {
  .content-inner {
    max-width: 1440px;
  }
}

@media (max-width: 1180px) {
  .content-inner {
    max-width: none;
    width: 100%;
    padding-left: 32px;
    padding-right: 32px;
  }

  .concept-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .relationship-flow {
    grid-template-columns: 1fr;
  }

  .relationship-arrow {
    transform: rotate(90deg);
  }
}

@media (max-width: 900px) {
  .top-header {
    height: auto;
    min-height: 58px;
    gap: 12px;
    padding: 10px 14px;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .brand-logo {
    width: 42px;
    height: 34px;
    font-size: 14px;
  }

  .brand-text {
    min-width: 0;
  }

  .brand-text strong {
    font-size: 14px;
    white-space: nowrap;
  }

  .brand-text span {
    font-size: 12px;
  }

  .header-search {
    order: 3;
    flex-basis: 100%;
    width: 100%;
  }

  .header-search input {
    width: 100%;
    height: 42px;
    font-size: 16px;
  }

  .header-actions {
    display: none;
  }

  .main-nav {
    padding-left: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    padding: 0;
  }

  .nav-link {
    min-height: 44px;
    padding: 0 16px;
    white-space: nowrap;
  }

  .nav-dropdown {
    position: fixed;
    top: 104px;
    left: 12px;
    right: 12px;
    width: auto;
    min-width: auto;
    max-width: none;
    border-radius: 16px;
    z-index: 200;
  }

  .app-layout {
    display: block;
    height: auto;
    overflow: visible;
  }

  .left-sidebar {
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    -webkit-overflow-scrolling: touch;
  }

  .left-sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar-title {
    display: none;
  }

  .sidebar-list {
    display: flex;
    gap: 8px;
    min-width: max-content;
  }

  .sidebar-section-label {
    min-height: 40px;
    margin: 0;
    padding: 9px 14px;
    border-radius: 999px;
    background: #FFFFFF;
    white-space: nowrap;
  }

  .sidebar-section-label::after {
    display: none;
  }

  .sidebar-link {
    min-height: 40px;
    padding: 9px 14px;
    border-left: none;
    border-radius: 999px;
    background: #FFFFFF;
    white-space: nowrap;
    font-size: 14px;
  }

  .sidebar-link.active {
    background: var(--primary);
    color: #FFFFFF;
  }

  .content {
    height: auto;
    min-height: auto;
    display: block;
    overflow: visible;
  }

  .content-inner {
    width: 100%;
    max-width: none;
    padding-left: 16px;
    padding-right: 16px;
  }

  .lesson-header-wrapper {
    position: relative;
    background: rgba(246, 249, 255, 0.96);
    backdrop-filter: blur(10px);
  }

  .lesson-header-inner {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .lesson-breadcrumb {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .lesson-top {
    gap: 14px;
  }

  h1 {
    font-size: 26px;
    line-height: 1.15;
  }

  .bookmark-btn {
    width: 38px;
    height: 38px;
    margin-top: 8px;
    font-size: 24px;
  }

  .lesson-nav {
    gap: 10px;
    padding-top: 14px;
  }

  .lesson-nav button {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    font-size: 13px;
  }

  .content-body {
    overflow: visible;
    padding-top: 18px;
    padding-bottom: 56px;
  }

  .lesson-block {
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 18px;
  }

  .lesson-block h2 {
    font-size: 22px;
    line-height: 1.25;
  }

  .lesson-block h3 {
    font-size: 19px;
    line-height: 1.3;
  }

  .concept-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .concept-card {
    padding: 16px;
    border-radius: 14px;
  }

  .concept-card h3 {
    font-size: 17px;
  }

  .db-hierarchy {
    gap: 8px;
  }

  .db-hierarchy span {
    padding: 9px 13px;
    font-size: 14px;
  }

  .relationship-flow {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .relationship-box {
    padding: 16px;
    border-radius: 14px;
  }

  .relationship-arrow {
    transform: rotate(90deg);
    font-size: 24px;
  }

  .null-warning {
    padding: 15px 16px;
    border-radius: 12px;
  }

  .grain-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 600px) {
  .brand-text span {
    display: none;
  }

  .top-header {
    padding: 9px 12px;
  }

  .brand-logo {
    width: 38px;
    height: 32px;
  }

  .content-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .lesson-block {
    padding: 18px 16px;
  }

  .lesson-block h2 {
    font-size: 21px;
  }

  .lesson-block h3 {
    font-size: 18px;
  }

  .lesson-nav {
    flex-direction: column;
  }

  .lesson-nav button {
    width: 100%;
  }

  .concept-grid {
    grid-template-columns: 1fr;
  }

  .concept-card {
    padding: 15px;
  }

  .db-hierarchy {
    display: grid;
    grid-template-columns: 1fr;
  }

  .db-hierarchy span {
    width: 100%;
    text-align: center;
  }

  .relationship-box {
    padding: 15px;
  }

  .relationship-arrow {
    font-size: 22px;
  }
}