/* DiplomaStudy - Layout v2.2 (Bottom Nav Fixed + Brand) */

/* ═══════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--color-bg);
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  padding-top: var(--safe-top);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
  gap: 8px;
  transition: box-shadow var(--transition-smooth), background var(--transition-smooth);
}

.app-header.scrolled {
  box-shadow: 0 4px 12px rgba(28, 62, 44, 0.06);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .app-header.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Header - Icon button */
.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-spring);
  font-family: inherit;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.header-icon-btn:hover {
  background: var(--color-forest-soft);
  border-color: var(--color-forest-soft);
  color: var(--color-forest);
}

.header-icon-btn:active {
  transform: scale(0.92);
  background: var(--color-sage-light);
}

.header-icon-btn svg {
  transition: transform var(--transition-spring);
}

.header-icon-btn:hover svg {
  transform: scale(1.1);
}

/* Header - Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 4px 6px;
}

.header-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad-forest);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.5px;
  box-shadow: 0 3px 8px rgba(28, 62, 44, 0.2);
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.header-brand-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-forest);
  letter-spacing: -0.3px;
}

/* Header - Title block */
.app-header-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
}

.app-header-title.centered {
  text-align: center;
  align-items: center;
}

.app-header-title.left {
  text-align: left;
  align-items: flex-start;
}

.app-header-title-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.3px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.app-header-title-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Header - Settings button */
.header-settings-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-spring);
  font-family: inherit;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.header-settings-btn:hover {
  color: var(--color-forest);
  border-color: var(--color-sage);
  background: var(--color-forest-soft);
  transform: rotate(45deg);
}

.header-settings-btn:active {
  transform: rotate(45deg) scale(0.92);
}

/* ═══════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════ */
.app-main {
  flex: 1;
  padding: var(--container-padding);
  padding-bottom: calc(var(--bottom-nav-height) + 24px + var(--safe-bottom));
  max-width: var(--max-content-width);
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════
   BOTTOM NAVIGATION — FORCED HORIZONTAL
   ═══════════════════════════════════════════ */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  top: auto !important;
  z-index: 50 !important;
  padding-bottom: var(--safe-bottom);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--color-border-subtle);
  box-shadow: 0 -4px 24px rgba(28, 62, 44, 0.06);
  transition: box-shadow var(--transition-smooth);
  display: block !important;
  width: 100% !important;
  height: auto !important;
}

[data-theme="dark"] .bottom-nav {
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.bottom-nav-inner {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  height: var(--bottom-nav-height);
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 8px;
  align-items: stretch !important;
  width: 100% !important;
}

.nav-item {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  padding: 8px 4px !important;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-dim);
  text-decoration: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition-fast);
  overflow: hidden;
  border-radius: 10px;
}

.nav-item:hover {
  color: var(--color-forest);
}

.nav-item.active {
  color: var(--color-forest);
}

.nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 40px;
  height: 3px;
  background: var(--grad-forest);
  border-radius: 0 0 4px 4px;
  transition: transform var(--transition-spring);
  transform-origin: center;
}

.nav-item.active::before {
  transform: translateX(-50%) scaleX(1);
}

.nav-item-icon {
  position: relative !important;
  width: 40px;
  height: 32px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 10px;
  transition: all var(--transition-spring);
}

.nav-item-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  transition: transform var(--transition-spring);
  stroke-width: 2;
}

.nav-item:hover .nav-item-icon svg {
  transform: translateY(-2px) scale(1.05);
}

.nav-item.active .nav-item-icon {
  background: var(--color-forest-soft);
}

.nav-item.active .nav-item-icon svg {
  stroke-width: 2.4;
  transform: translateY(-1px);
}

.nav-item:active .nav-item-icon svg {
  transform: scale(0.9);
}

.nav-item-label {
  display: block !important;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1px;
  line-height: 1;
  text-align: center;
  transition: font-weight var(--transition-fast);
}

.nav-item.active .nav-item-label {
  color: var(--color-forest);
  font-weight: 800;
}

.nav-lock-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav-item.locked {
  opacity: 0.75;
}

.nav-item.locked .nav-item-icon svg {
  opacity: 0.6;
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(16, 23, 18, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

/* ═══════════════════════════════════════════
   INITIAL LOADER
   ═══════════════════════════════════════════ */
.initial-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 40px 20px;
  text-align: center;
}

.initial-loader-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--grad-forest);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
  box-shadow: 0 12px 28px rgba(28, 62, 44, 0.25);
  animation: float 3s ease-in-out infinite;
}

.initial-loader-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-forest);
  margin-top: 16px;
  margin-bottom: 4px;
}

.initial-loader-sub {
  font-size: 12px;
  color: var(--color-text-dim);
  font-weight: 500;
}

/* ═══════════════════════════════════════════
   PAGE CONTAINER
   ═══════════════════════════════════════════ */
.page-container {
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════
   SCROLL BEHAVIOR
   ═══════════════════════════════════════════ */
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior-y: none;
}

.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 380px) {
  .nav-item-icon {
    width: 36px;
    height: 30px;
  }
  .nav-item-icon svg {
    width: 20px;
    height: 20px;
  }
  .nav-item-label {
    font-size: 9.5px;
  }
  .header-brand-name {
    display: none;
  }
}

@media (min-width: 700px) {
  .app-main {
    padding: 24px;
    padding-bottom: calc(var(--bottom-nav-height) + 32px);
  }
}

/* ═══════════════════════════════════════════
   FORCE OVERRIDE — prevents any external CSS conflict
   ═══════════════════════════════════════════ */
#bottom-nav.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  top: auto !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
}

#bottom-nav .bottom-nav-inner {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  width: 100% !important;
}

#bottom-nav .nav-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

#bottom-nav .nav-item-icon,
#bottom-nav .nav-item-label {
  display: flex !important;
}
/* ═══════════════════════════════════════════
   HEADER ACTIONS (multiple buttons)
   ═══════════════════════════════════════════ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header-actions .header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

@media (max-width: 380px) {
  .header-actions {
    gap: 0;
  }
  .header-actions .header-icon-btn {
    width: 36px;
    height: 36px;
  }
}