/*
 * LAYOUT.CSS - Структура и макет
 * Содержит: header, main wrapper, footer, grid системы, контейнеры
 */

/* ===== HEADER ===== */
/* .top-header {
  display: flex;
  align-items: center;
  background-color: var(--bg-primary);
  height: var(--header-height);
  position: fixed;
  border-bottom: 0px solid var(--border-color);
  left: 0px;
  right: 0;
  top: 0;
  padding: 0 0rem;
  z-index: 11;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm) !important;
  opacity: 0.9;
}

.top-header .navbar {
  width: 100%;
}

.top-header .search-bar {
  display: flex !important;
  flex-grow: 1 !important;
}

.top-header .navbar-nav {
  display: flex !important;
  align-items: center !important;
}

.top-header .navbar .logo-header {
  width: auto;
  height: auto;
  padding: 0;
  gap: 0.5rem;
  z-index: 5;
  position: relative;
  border-right: 0px solid var(--border-color);
  border-left: 0px solid var(--border-color);
}

.top-header .navbar .dropdown-menu {
  border-radius: var(--border-radius-lg);
  border: 0;
  animation: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1 slideDown;
}

.top-header .btn-toggle a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #494949;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  transition: var(--transition-base);
}

.top-header .btn-toggle a:hover,
.top-header .btn-toggle a:focus {
  background-color: #efefef;
}

.top-header .nav-right-links .nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #494949;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  transition: var(--transition-base);
}

.top-header .nav-right-links .nav-link:hover,
.top-header .nav-right-links .nav-link:focus {
  background-color: #efefef;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  margin-top: var(--header-height);
  transition: var(--transition-base);
  min-height: calc(100vh - var(--header-height));
}

.main-wrapper .main-content {
  padding: 0rem;
}

.main-wrapper .main-content .breadcrumb-title {
  font-size: 20px;
  border-right: 1.5px solid #aaa4a4;
}

.main-wrapper .main-content .page-breadcrumb .breadcrumb li.breadcrumb-item {
  font-size: 16px;
}

.main-wrapper .main-content .page-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  display: inline-block;
  padding-right: 0.5rem;
  font-family: "Material Icons Outlined";
  content: "\e88a";
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  position: fixed;
  top: var(--header-height);
  left: 0;
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  z-index: 10;
  transition: var(--transition-base);
  overflow-y: auto;
}

.sidebar.collapsed {
  width: 60px;
}

.main-content-with-sidebar {
  margin-left: var(--sidebar-width);
  transition: var(--transition-base);
}

.main-content-with-sidebar.sidebar-collapsed {
  margin-left: 60px;
}

/* ===== FOOTER ===== */
.page-footer {
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: auto;
}

.page-footer .footer-links a {
  color: var(--primary-color);
}

/* ===== CONTAINERS ===== */
.container-fluid-custom {
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
}

.container-chat {
  height: calc(100vh - var(--header-height));
  max-height: calc(100vh - var(--header-height));
}

/* ===== GRID SYSTEM ===== */
.row-custom {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

.col-custom {
  position: relative;
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
}

/* ===== FLEXBOX UTILITIES ===== */
.d-flex-custom {
  display: flex !important;
}

.flex-column-custom {
  flex-direction: column !important;
}

.flex-row-custom {
  flex-direction: row !important;
}

.justify-content-center-custom {
  justify-content: center !important;
}

.justify-content-between-custom {
  justify-content: space-between !important;
}

.align-items-center-custom {
  align-items: center !important;
}

.flex-grow-1-custom {
  flex-grow: 1 !important;
}

.flex-shrink-0-custom {
  flex-shrink: 0 !important;
}

/* ===== RESPONSIVE LAYOUT ===== */
@media screen and (max-width: 1024px) {
  .sidebar {
    left: -var(--sidebar-width);
  }

  .sidebar.show {
    left: 0;
  }

  .main-content-with-sidebar {
    margin-left: 0;
  }

  .chat-content {
    margin-left: var(--sidebar-width);
  }

  .chat-sidebar {
    left: 0;
    width: var(--sidebar-width);
  }
}

@media screen and (max-width: 768px) {
  .top-header {
    padding: 0 1rem;
  }

  .main-wrapper .main-content {
    padding: 1rem;
  }

  .container-chat {
    height: calc(100vh - var(--header-height) - 2rem);
  }
}

@media screen and (max-width: 576px) {
  .top-header {
    height: 60px;
  }

  :root {
    --header-height: 60px;
  }

  .main-wrapper {
    margin-top: 60px;
  }

  .sidebar {
    height: calc(100vh - 60px);
    top: 60px;
  }
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  display: none;
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-size: 26px;
  color: #fff;
  position: fixed;
  border-radius: 10px;
  bottom: 110px;
  right: 10px;
  background-image: linear-gradient(310deg, #00c6fb 0%, #005bea 100%) !important;
  background-color: var(--primary-color);
  z-index: 5;
  transition: var(--transition-base);
}

.back-to-top:hover {
  color: #fff;
  background-color: var(--dark-color);
  transition: var(--transition-base);
}

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9;
  display: none;
}

.overlay.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ===== LOADING ===== */
.loading-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--light-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
