/* ======================================================
   Base layout styles
   Мониторинг окружающей среды
   ====================================================== */

/* ---------- CSS reset (минимальный) ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: #1f2937;
    line-height: 1.5;
}

/* ---------- Links ---------- */
a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

/* ======================================================
   TOPBAR
   ====================================================== */
.topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.system-name {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ---------- User info ---------- */
.user-info {
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.user-region {
    font-size: 12px;
    color: #6b7280;
}

/* ---------- Language switcher ---------- */
.lang-switcher select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    font-size: 13px;
}

/* ---------- Auth buttons ---------- */
.login-btn,
.logout-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background: #0ea5e9;
    color: #ffffff;
}

.logout-btn {
    background: #ef4444;
}

.login-btn:hover,
.logout-btn:hover {
    opacity: 0.9;
}

/* ======================================================
   MAIN LAYOUT
   ====================================================== */
.layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

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

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #e5e7eb;
    transition: background-color 0.15s ease;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* ======================================================
   CONTENT AREA
   ====================================================== */
.main-content {
    flex: 1;
    padding: 24px 32px;
    background-color: #f5f7fa;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

/* ---------- Page content container ---------- */
.page-content {
    background: transparent;
}

/* ======================================================
   FOOTER
   ====================================================== */
.footer {
    height: 48px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #6b7280;
}

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 991px) {
    .sidebar {
        display: none;
    }

    .main-content {
        padding: 20px;
    }

    .system-name {
        font-size: 16px;
    }
}

.logout-form {
    display: inline;
}

.logout-form button {
    background: none;
    border: none;
    padding: 0;
    color: #8c1919;
    cursor: pointer;
    font-size: 14px;
}


@media (max-width: 575px) {
    .topbar {
        padding: 0 16px;
    }

    .user-info {
        display: none;
    }
}

.tunduk-btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.tunduk-btn.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.auto-filled {
  background-color: #f0f9ff;
  transition: background-color 0.3s;
}
/* ===== Sidebar container ===== */
.sidebar {
    background: #0b1220; /* строгий тёмный */
    color: #e5e7eb;
    width: 260px;
    min-height: 100vh;
    padding: 18px 14px;
}

/* Заголовок системы / логотип */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 14px;
}

.sidebar-brand img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.sidebar-brand .brand-title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    color: #f8fafc;
}

/* Секция */
.sidebar-section {
    margin-top: 14px;
}

.sidebar-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    padding: 10px 10px 8px;
}

/* ===== Menu ===== */
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Если используешь li.sidebar-item */
.sidebar-item {
    margin-bottom: 6px;
}

/* Link / Item appearance */
.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;

    color: rgba(255,255,255,0.86);
    background: transparent;

    /* чтобы длинные названия не ломали */
    min-width: 0;
}

/* Текст внутри ссылки */
.sidebar-link .sidebar-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Hover */
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
}

/* Active */
.sidebar-link.active {
    background: rgba(99, 102, 241, 0.18);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.28);
    color: #ffffff;
}

/* Маленькая "полоска" слева на active (строго и красиво) */
.sidebar-link.active::before {
    content: "";
    width: 3px;
    height: 18px;
    background: #6366f1;
    border-radius: 2px;
    margin-right: 8px;
}

/* Чтобы ::before не ломал layout */
.sidebar-link.active {
    position: relative;
    padding-left: 12px;
}

/* Disabled (в разработке) */
.sidebar-link.disabled {
    color: rgba(255,255,255,0.45);
    cursor: default;
    background: rgba(255,255,255,0.03);
}

.sidebar-link.disabled:hover {
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.45);
}

/* Note (в разработке) */
.sidebar-note {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    flex-shrink: 0;
}

/* Divider */
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 12px 10px;
}

/* Mobile */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
}


.topbar-home-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.topbar-home-link:hover {
    opacity: 0.9;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;

    color: rgba(255,255,255,0.86);
    transition: background 0.15s ease;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(99,102,241,0.18);
    box-shadow: inset 0 0 0 1px rgba(99,102,241,0.28);
}

.sidebar-note {
    font-size: 11px;
    opacity: 0.6;
}
