/* === PUBLIC LAYOUT === */
.public-header {
  background: var(--color-primary);
  color: white;
  padding: 1rem 0;
}

.public-header .brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.public-header .brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.public-header .nav-link {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  font-size: 0.95rem;
  margin-left: 1.5rem;
}

.public-header .nav-link:hover {
  color: white;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* === DASHBOARD LAYOUT === */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  position: fixed;
  height: 100vh;
  z-index: 100;
  overflow: hidden;
}

.sidebar-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.sidebar-header .brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

/* Theme-aware logo: dark mode = logo2, light mode = logo */
.brand-logo-light {
  display: none;
}
.brand-logo-dark {
  display: inline-block;
}
:root[data-theme="light"] .brand-logo-light {
  display: inline-block;
}
:root[data-theme="light"] .brand-logo-dark {
  display: none;
}

.logo-icon {
  background: var(--color-primary);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-family: var(--font-logo);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1 1 0;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
  padding-left: 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.82rem;
  animation: slideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.1s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.2s; }
.nav-item:nth-child(5) { animation-delay: 0.25s; }
.nav-item:nth-child(6) { animation-delay: 0.3s; }
.nav-item:nth-child(7) { animation-delay: 0.35s; }

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--color-hover-primary-05);
  color: var(--color-primary);
}

.nav-item.active {
  font-weight: 600;
}

.nav-item.text-danger:hover {
  background: var(--color-hover-danger-05);
}

/* SIDEBAR FOOTER / PROFILE */
.sidebar-footer {
  flex-shrink: 0;
  margin-top: 0.7rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.6rem;
}

.sidebar-copyright {
  margin-top: 0.45rem;
  text-align: center;
}

.sidebar-copyright p {
  font-size: 0.62rem;
  line-height: 1.2;
  color: var(--color-text-muted);
  margin: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-primary);
}

.user-avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.78rem;
}

.user-company,
.user-email {
  font-size: 0.66rem;
  color: var(--color-text-muted);
}

/* MAIN CONTENT AREA */
.dashboard-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashboard-header {
  height: var(--header-height);
  background: var(--color-bg-sidebar);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-bg-light);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  width: 300px;
}

.search-bar i {
  color: var(--color-text-muted);
  width: 18px;
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-notifications {
  position: relative;
}

.notification-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: inherit;
}

.notification-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--color-danger);
  color: var(--color-white);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.header-notifications-panel {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  width: min(400px, 90vw);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.9rem;
  z-index: 120;
}

.header-notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.header-notifications-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}

.header-notifications-mark-all {
  font-size: 0.75rem;
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
}

.header-notifications-mark-all:hover {
  text-decoration: underline;
}

.header-notifications-empty {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.header-notifications-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 380px;
  overflow-y: auto;
}

.header-notification-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  transition: opacity 0.2s ease;
}

.header-notification-item--read {
  opacity: 0.55;
}

.header-notification-icon {
  flex-shrink: 0;
  width: 1.3rem;
  margin-top: 0.15rem;
}

.header-notification-icon svg {
  width: 1rem;
  height: 1rem;
}

.header-notification-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header-notification-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-notification-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.header-notification-time {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.header-notification-title {
  font-weight: 500;
  font-size: 0.82rem;
  line-height: 1.3;
}

.header-notification-link {
  color: inherit;
  text-decoration: none;
}

.header-notification-link:hover {
  text-decoration: underline;
}

.header-notification-message {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.header-notification-mark-read {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.header-notification-mark-read:hover {
  color: var(--color-success);
  background: var(--color-success-bg);
}

.header-notification-mark-read svg {
  width: 0.9rem;
  height: 0.9rem;
}

.header-notification-item--info {
  background: var(--color-info-bg, rgba(59, 130, 246, 0.06));
}

.header-notification-item--info .header-notification-label {
  color: var(--color-primary, #3b82f6);
}

.header-notification-item--warning {
  background: var(--color-warning-bg);
}

.header-notification-item--warning .header-notification-label {
  color: var(--color-warning);
}

.header-notification-item--error {
  background: var(--color-danger-bg-soft);
}

.header-notification-item--error .header-notification-label {
  color: var(--color-danger);
}

.header-notification-item--success {
  background: var(--color-success-bg);
}

.header-notification-item--success .header-notification-label {
  color: var(--color-success);
}

.hidden {
  display: none !important;
}

.dashboard-content {
  padding: 2rem;
  min-width: 0;
}

.dashboard-content [id$="-card"],
.dashboard-content [id$="-feedback"] {
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

/* === PUBLIC NAV HELPERS === */
.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-form {
  margin: 0;
}

.nav-button {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.nav-item-button {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 80px;
    padding: 1.4rem 0.45rem;
    align-items: center;
  }

  .brand-name,
  .nav-item span,
  .nav-section-title,
  .user-info {
    display: none;
  }

  .sidebar-copyright {
    display: none;
  }

  .dashboard-main {
    margin-left: 80px;
  }

  .logo-icon {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 768px) {
  .nav-links {
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .dashboard-content {
    padding: 1rem;
  }

  .search-bar {
    width: 100%;
    max-width: 100%;
  }

  .sidebar {
    width: 64px;
    padding: 1.2rem 0.4rem;
  }

  .dashboard-main {
    margin-left: 64px;
  }
}
