@use "sass:color";
// === adsPRO - Nowe style ===

// --- Zmienne ---
$cPrimary: #6690F4;
$cPrimaryDark: #3164db;
$cSidebarBg: #1E2A3A;
$cSidebarText: #A8B7C7;
$cSidebarHover: #263548;
$cSidebarActive: $cPrimary;
$cContentBg: #F4F6F9;
$cWhite: #FFFFFF;
$cText: #4E5E6A;
$cTextDark: #2D3748;
$cBorder: #E2E8F0;
$cSuccess: #57B951;
$cSuccessDark: #4a9c3b;
$cDanger: #CC0000;
$cDangerDark: #b30000;
$cWarning: #FF8C00;
$cGreenLight: #57b951;

$sidebarWidth: 260px;
$sidebarCollapsed: 70px;
$topbarHeight: 56px;
$transitionSpeed: 0.3s;

// --- Reset i baza ---
* {
  box-sizing: border-box;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: $cText;
  background: $cContentBg;
  max-width: 100vw;
  overflow-x: hidden;
}

.hide {
  display: none;
}

// --- Typografia ---
small {
  font-size: .75em;
}

.text-right {
  text-align: right;
}

.text-bold {
  font-weight: 700 !important;
}

.nowrap {
  white-space: nowrap;
}

// ===========================
// LOGIN PAGE (unlogged)
// ===========================
body.unlogged {
  background: $cContentBg;
  margin: 0;
  padding: 0;
}

.login-container {
  display: flex;
  min-height: 100vh;
}

.login-brand {
  flex: 0 0 45%;
  background: linear-gradient(135deg, $cSidebarBg 0%, #2C3E57 50%, $cPrimary 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba($cPrimary, 0.15) 0%, transparent 70%);
    border-radius: 50%;
  }

  .brand-content {
    position: relative;
    z-index: 1;
    color: $cWhite;
    max-width: 400px;
  }

  .brand-logo {
    font-size: 48px;
    font-weight: 300;
    margin-bottom: 20px;
    letter-spacing: -1px;

    strong {
      font-weight: 700;
    }
  }

  .brand-tagline {
    font-size: 18px;
    opacity: 0.85;
    line-height: 1.6;
    margin-bottom: 50px;
  }

  .brand-features {
    .feature {
      display: flex;
      align-items: center;
      gap: 15px;
      margin-bottom: 20px;
      opacity: 0.8;

      i {
        font-size: 20px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba($cWhite, 0.1);
        border-radius: 10px;
      }

      span {
        font-size: 15px;
      }
    }
  }
}

.login-form-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  background: $cWhite;
}

.login-box {
  width: 100%;
  max-width: 420px;

  .login-header {
    margin-bottom: 35px;

    h1 {
      font-size: 28px;
      font-weight: 700;
      color: $cTextDark;
      margin: 0 0 8px;
    }

    p {
      color: #718096;
      font-size: 15px;
      margin: 0;
    }
  }

  .form-group {
    margin-bottom: 20px;

    label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      color: $cTextDark;
      margin-bottom: 6px;
    }
  }

  .input-with-icon {
    position: relative;

    i {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: #A0AEC0;
      font-size: 14px;
    }

    .form-control {
      padding-left: 42px;
    }
  }

  .form-control {
    width: 100%;
    height: 46px;
    border: 2px solid $cBorder;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 14px;
    font-family: "Roboto", sans-serif;
    color: $cTextDark;
    transition: border-color $transitionSpeed, box-shadow $transitionSpeed;

    &::placeholder {
      color: #CBD5E0;
    }

    &:focus {
      border-color: $cPrimary;
      box-shadow: 0 0 0 3px rgba($cPrimary, 0.15);
      outline: none;
    }
  }

  .form-error {
    color: $cDanger;
    font-size: 12px;
    margin-top: 4px;
  }

  .checkbox-group {
    .checkbox-label {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      font-size: 13px;
      color: #718096;
      font-weight: 400;

      input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: $cPrimary;
      }
    }
  }

  .btn-login {
    width: 100%;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    &.disabled {
      opacity: 0.7;
      pointer-events: none;
    }
  }

  .alert {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;

    &.alert-danger {
      background: #FFF5F5;
      color: $cDanger;
      border: 1px solid #FED7D7;
    }

    &.alert-success {
      background: #F0FFF4;
      color: #276749;
      border: 1px solid #C6F6D5;
    }
  }
}

// Responsywność logowania
@media (max-width: 768px) {
  .login-brand {
    display: none;
  }

  .login-form-wrapper {
    padding: 30px 20px;
  }
}

// ===========================
// LAYOUT (logged) - SIDEBAR
// ===========================
body.logged {
  display: flex;
  min-height: 100vh;
  background: $cContentBg;
}

// --- Sidebar ---
.sidebar {
  width: $sidebarWidth;
  min-height: 100vh;
  background: $cSidebarBg;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width $transitionSpeed ease;
  overflow: hidden;

  &.collapsed {
    width: $sidebarCollapsed;

    .sidebar-header {
      padding: 16px 0;
      justify-content: center;

      .sidebar-logo {
        display: none;
      }

      .sidebar-toggle i {
        transform: rotate(180deg);
      }
    }

    .sidebar-nav ul li a {
      padding: 12px 0;
      justify-content: center;

      span {
        display: none;
      }

      i {
        margin-right: 0;
        font-size: 18px;
      }
    }

    .sidebar-nav ul li.nav-group .nav-group-label {
      padding: 12px 0;
      justify-content: center;

      span {
        display: none;
      }

      i {
        margin-right: 0;
        font-size: 18px;
      }
    }

    .sidebar-footer {
      .sidebar-user {
        justify-content: center;

        .user-info {
          display: none;
        }
      }

      .sidebar-logout {
        justify-content: center;

        span {
          display: none;
        }
      }
    }

    .nav-divider {
      margin: 8px 15px;
    }
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba($cWhite, 0.08);

  .sidebar-logo a {
    color: $cWhite;
    text-decoration: none;
    font-size: 24px;
    font-weight: 300;
    letter-spacing: -0.5px;

    strong {
      font-weight: 700;
    }
  }

  .sidebar-toggle {
    background: none;
    border: none;
    color: $cSidebarText;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all $transitionSpeed;

    &:hover {
      background: rgba($cWhite, 0.08);
      color: $cWhite;
    }

    i {
      transition: transform $transitionSpeed;
    }
  }
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;

  ul {
    list-style: none;
    margin: 0;
    padding: 0;

    li {
      &.nav-group {
        margin-bottom: 4px;

        .nav-group-label {
          display: flex;
          align-items: center;
          padding: 11px 20px;
          color: #D5DEEA;
          font-size: 12px;
          font-weight: 700;
          text-transform: uppercase;
          letter-spacing: 0.6px;
          border-left: 3px solid transparent;

          i {
            width: 20px;
            text-align: center;
            margin-right: 12px;
            font-size: 14px;
            color: #B6C4D3;
          }
        }

        .nav-submenu {
          margin: 0;
          padding: 0;
          list-style: none;

          li a {
            padding-left: 44px;
          }
        }

        &.active>.nav-group-label {
          color: $cWhite;
          background: rgba($cPrimary, 0.12);
          border-left-color: $cPrimary;

          i {
            color: $cPrimary;
          }
        }
      }

      &.nav-divider {
        height: 1px;
        background: rgba($cWhite, 0.08);
        margin: 8px 20px;
      }

      a {
        display: flex;
        align-items: center;
        padding: 11px 20px;
        color: $cSidebarText;
        text-decoration: none;
        font-size: 14px;
        transition: all 0.2s;
        border-left: 3px solid transparent;

        i {
          width: 20px;
          text-align: center;
          margin-right: 12px;
          font-size: 15px;
        }

        &:hover {
          background: $cSidebarHover;
          color: $cWhite;
        }
      }

      &.active>a {
        background: rgba($cPrimary, 0.15);
        color: $cWhite;
        border-left-color: $cPrimary;

        i {
          color: $cPrimary;
        }
      }
    }
  }
}

.badge-alerts-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 8px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: $cWhite;
  color: $cPrimary;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba($cWhite, 0.08);

  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;

    .user-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: rgba($cPrimary, 0.2);
      display: flex;
      align-items: center;
      justify-content: center;
      color: $cPrimary;
      font-size: 14px;
      flex-shrink: 0;
    }

    .user-info {
      overflow: hidden;

      .user-email {
        color: $cSidebarText;
        font-size: 12px;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }

  .sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #E53E3E;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.2s;

    i {
      font-size: 14px;
    }

    &:hover {
      background: rgba(#E53E3E, 0.1);
    }
  }
}

// --- Main wrapper ---
.main-wrapper {
  margin-left: $sidebarWidth;
  flex: 1;
  min-height: 100vh;
  transition: margin-left $transitionSpeed ease;
  display: flex;
  flex-direction: column;

  &.expanded {
    margin-left: $sidebarCollapsed;
  }
}

// --- Topbar ---
.topbar {
  height: $topbarHeight;
  background: $cWhite;
  border-bottom: 1px solid $cBorder;
  display: flex;
  align-items: center;
  padding: 0 25px;
  position: sticky;
  top: 0;
  z-index: 500;

  .topbar-toggle {
    background: none;
    border: none;
    color: $cText;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 16px;
    margin-right: 15px;
    transition: all 0.2s;

    &:hover {
      background: $cContentBg;
    }
  }

  .topbar-breadcrumb {
    font-size: 16px;
    font-weight: 600;
    color: $cTextDark;
  }
}

// --- Content area ---
.content {
  flex: 1;
  padding: 25px;
}

.app-alert {
  background: #EBF8FF;
  border: 1px solid #BEE3F8;
  color: #2B6CB0;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

// ===========================
// KOMPONENTY WSPÓLNE
// ===========================

// --- Buttons ---
.btn {
  padding: 10px 20px;
  transition: all 0.2s ease;
  color: $cWhite;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  text-decoration: none;
  gap: 6px;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  font-weight: 500;

  &.btn_small,
  &.btn-xs,
  &.btn-sm {
    padding: 5px 10px;
    font-size: 12px;

    i {
      font-size: 11px;
    }
  }

  &.btn-success {
    background: $cSuccess;

    &:hover {
      background: $cSuccessDark;
    }
  }

  &.btn-primary {
    background: $cPrimary;

    &:hover {
      background: $cPrimaryDark;
    }
  }

  &.btn-danger {
    background: $cDanger;

    &:hover {
      background: $cDangerDark;
    }
  }

  &.disabled {
    opacity: 0.6;
    pointer-events: none;
  }
}

// --- Form controls ---
.form-control {
  border: 1px solid $cBorder;
  border-radius: 6px;
  height: 38px;
  width: 100%;
  padding: 6px 12px;
  font-family: "Roboto", sans-serif;
  font-size: 14px;
  color: $cTextDark;
  transition: border-color 0.2s, box-shadow 0.2s;

  option {
    padding: 5px;
  }

  &:focus {
    border-color: $cPrimary;
    box-shadow: 0 0 0 3px rgba($cPrimary, 0.1);
    outline: none;
  }
}

input[type="checkbox"] {
  border: 1px solid $cBorder;
}

// --- Tables ---
table {
  border-collapse: collapse;
  font-size: 13px;
}

.table {
  width: 100%;

  th,
  td {
    border: 1px solid $cBorder;
    padding: 8px 10px;
  }

  th {
    background: #F7FAFC;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #718096;
  }

  td.center {
    text-align: center;
  }

  td.left {
    text-align: left;
  }

  &.table-sm td {
    padding: 5px !important;
  }

  input.form-control {
    font-size: 13px;
    height: 32px;
  }
}

// --- Unified app tables (clients/campaigns/products/logs) ---
.clients-table-wrap,
.campaigns-table-wrap,
.products-table-wrap,
.logs-table-wrap {
  background: $cWhite;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  overflow-x: auto;
  max-width: 100%;
  -ms-overflow-style: none;
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }

  .table {
    margin: 0;
    width: 100% !important;

    thead th {
      background: #F8FAFC;
      border-bottom: 2px solid $cBorder;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: #8899A6;
      padding: 12px 16px;
      white-space: nowrap;
    }

    tbody td {
      padding: 10px 16px;
      font-size: 13px;
      color: $cTextDark;
      vertical-align: middle;
      border-bottom: 1px solid #F1F5F9;
    }

    tbody tr:hover td {
      background: #F8FAFC;
    }
  }

  .dt-layout-row {
    padding: 14px 20px;
    margin: 0 !important;
    border-top: 1px solid #F1F5F9;

    &:first-child {
      display: none;
    }
  }

  .dt-info {
    font-size: 13px;
    color: #8899A6;
  }

  .dt-paging {
    .pagination {
      margin: 0;
      padding: 0;
      list-style: none;
      display: flex;
      align-items: center;
      gap: 6px;

      .page-item {
        .page-link {
          display: inline-flex;
          align-items: center;
          justify-content: center;
          min-width: 36px;
          width: fit-content;
          height: 36px;
          padding: 0 14px;
          border-radius: 8px;
          font-size: 13px;
          font-weight: 500;
          border: 1px solid $cBorder;
          background: $cWhite;
          color: $cText;
          cursor: pointer;
          transition: all 0.2s;
          text-decoration: none;
          line-height: 1;
          white-space: nowrap;

          &:hover {
            background: #EEF2FF;
            color: $cPrimary;
            border-color: $cPrimary;
          }
        }

        &.active .page-link {
          background: $cPrimary;
          color: $cWhite;
          border-color: $cPrimary;
          font-weight: 600;
        }

        &.disabled .page-link {
          opacity: 0.35;
          cursor: default;
          pointer-events: none;
        }
      }
    }
  }

  .dt-processing {
    background: rgba($cWhite, 0.9);
    color: $cText;
    font-size: 14px;
  }
}

// --- Cards ---
.card {
  background: $cWhite;
  padding: 20px;
  border-radius: 8px;
  color: $cTextDark;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

  &.mb25 {
    margin-bottom: 20px;
  }

  .card-header {
    font-weight: 600;
    font-size: 15px;
  }

  .card-body {
    padding-top: 12px;

    table {

      th,
      td {
        font-size: 13px;

        &.bold {
          font-weight: 600;
        }

        &.text-right {
          text-align: right;
        }

        &.text-center {
          text-align: center;
        }
      }
    }
  }
}

// --- Action menu ---
.action_menu {
  display: flex;
  margin-bottom: 20px;
  gap: 12px;

  .btn {
    padding: 8px 16px;

    &.btn_add {
      background: $cSuccess;

      &:hover {
        background: $cSuccessDark;
      }
    }

    &.btn_cancel {
      background: $cDanger;

      &:hover {
        background: $cDangerDark;
      }
    }
  }
}

// --- Settings page ---
.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;

  .settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #6B7A89;
    background: #E9EEF5;
    border: 1px solid #D8E0EA;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;

    &:hover {
      color: $cTextDark;
      background: #DDE6F2;
    }

    &.active {
      color: $cWhite;
      background: $cPrimary;
      border-color: $cPrimary;
    }
  }
}

.settings-card {
  background: $cWhite;
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);

  .settings-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid $cBorder;

    .settings-card-icon {
      width: 44px;
      height: 44px;
      border-radius: 10px;
      background: color.adjust($cPrimary, $lightness: 26%);
      color: $cPrimary;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    h3 {
      margin: 0;
      font-size: 17px;
      font-weight: 600;
      color: $cTextDark;
    }

    small {
      color: #8899A6;
      font-size: 13px;
    }
  }

  .settings-field {
    margin-bottom: 18px;

    label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      color: $cTextDark;
      margin-bottom: 6px;
    }
  }

  .settings-input-wrap {
    position: relative;

    .settings-input-icon {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: #A0AEC0;
      font-size: 14px;
      pointer-events: none;
    }

    .form-control {
      padding-left: 38px;
    }

    .settings-toggle-pw {
      position: absolute;
      right: 4px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      color: #A0AEC0;
      cursor: pointer;
      padding: 6px 10px;
      font-size: 14px;
      transition: color 0.2s;

      &:hover {
        color: $cPrimary;
      }
    }
  }

  .settings-field .settings-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    margin-bottom: 0;
    width: 100%;

    .settings-toggle-text {
      flex: 1 1 auto;
      min-width: 0;
      line-height: 1.35;
    }
  }

  .settings-toggle-checkbox {
    display: none;

    &+.settings-toggle-switch {
      display: inline-block;
      position: relative;
      width: 44px;
      height: 24px;
      background: #ccc;
      border-radius: 12px;
      transition: background 0.2s;
      flex-shrink: 0;

      &::after {
        content: '';
        position: absolute;
        top: 3px;
        left: 3px;
        width: 18px;
        height: 18px;
        background: #fff;
        border-radius: 50%;
        transition: transform 0.2s;
      }
    }

    &:checked+.settings-toggle-switch {
      background: #22C55E;

      &::after {
        transform: translateX(20px);
      }
    }
  }

  .settings-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;

    @media (max-width: 768px) {
      grid-template-columns: 1fr;
    }
  }

  .settings-alert-error {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFF5F5;
    color: $cDanger;
    border: 1px solid #FED7D7;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;

    i {
      font-size: 16px;
      flex-shrink: 0;
    }
  }
}

// --- Clients page ---
// --- Feeds page ---
.feeds-page {
  .feeds-header {
    margin-bottom: 20px;

    h2 {
      margin: 0;
      font-size: 20px;
      font-weight: 600;
      color: $cTextDark;

      i {
        color: $cPrimary;
        margin-right: 8px;
      }
    }
  }

  .empty-state-box {
    text-align: center;
    padding: 50px 20px;
    color: #A0AEC0;

    i {
      font-size: 40px;
      margin-bottom: 12px;
      display: block;
    }

    p {
      margin: 0;
      font-size: 15px;
    }
  }

  .feed-link {
    color: $cPrimary;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;

    &:hover {
      text-decoration: underline;
    }

    i {
      font-size: 11px;
      margin-right: 4px;
    }
  }

  .btn-icon-copy {
    background: none;
    border: none;
    color: #8899A6;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 13px;
    margin-left: 6px;

    &:hover {
      color: $cPrimary;
    }
  }
}

.clients-page {
  .clients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;

    h2 {
      margin: 0;
      font-size: 20px;
      font-weight: 600;
      color: $cTextDark;

      i {
        color: $cPrimary;
        margin-right: 8px;
      }
    }
  }

  .clients-table-wrap {
    .table {
      .client-id {
        color: #8899A6;
        font-size: 13px;
        font-weight: 600;
      }

      .client-name {
        font-weight: 600;
        color: $cTextDark;
      }
    }
  }

  .badge-id {
    display: inline-block;
    background: #EEF2FF;
    color: $cPrimary;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
  }

  .actions-cell {
    text-align: center;
    white-space: nowrap;
  }

  .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    margin: 0 2px;

    &.btn-icon-edit {
      background: #EEF2FF;
      color: $cPrimary;

      &:hover {
        background: $cPrimary;
        color: $cWhite;
      }
    }

    &.btn-icon-delete {
      background: #FFF5F5;
      color: $cDanger;

      &:hover {
        background: $cDanger;
        color: $cWhite;
      }
    }

    &.btn-icon-sync {
      background: #F0FDF4;
      color: #16a34a;

      &:hover {
        background: #16a34a;
        color: $cWhite;
      }

      &:disabled {
        opacity: 0.7;
        cursor: wait;
      }

      &.is-queued {
        background: #FEF3C7;
        color: #D97706;
      }
    }
  }

  .client-sync-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .client-sync-row {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .client-sync-label {
    font-size: 11px;
    font-weight: 600;
    color: #8899A6;
    width: 18px;
    flex-shrink: 0;
  }

  .client-sync-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: #E9EEF5;
    overflow: hidden;
  }

  .client-sync-fill {
    height: 100%;
    border-radius: 999px;
    background: #CBD5E0;
    transition: width 0.4s ease;

    &.is-active {
      background: linear-gradient(90deg, #5A9BFF 0%, #2E6BDF 100%);
    }

    &.is-done {
      background: $cSuccess;
    }
  }

  .client-sync-pct {
    font-size: 11px;
    font-weight: 600;
    color: #8899A6;
    width: 32px;
    text-align: right;
    flex-shrink: 0;
  }

  .sync-dropdown {
    position: relative;
    display: inline-block;

    .sync-dropdown-menu {
      display: none;
      position: absolute;
      right: 0;
      top: 100%;
      z-index: 100;
      background: #fff;
      border: 1px solid #E2E8F0;
      border-radius: 8px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
      padding: 4px 0;
      min-width: 200px;
      white-space: nowrap;

      button {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 8px 14px;
        border: none;
        background: none;
        font-size: 13px;
        color: $cTextDark;
        cursor: pointer;
        text-align: left;

        &:hover {
          background: #F7FAFC;
        }

        &:disabled {
          opacity: 0.4;
          cursor: default;
        }

        i {
          width: 16px;
          text-align: center;
          color: #8899A6;
        }
      }
    }

    &.is-open .sync-dropdown-menu {
      display: block;
    }
  }

  .empty-state {
    text-align: center;
    padding: 50px 20px !important;
    color: #A0AEC0;

    i {
      font-size: 40px;
      margin-bottom: 12px;
      display: block;
    }

    p {
      margin: 0;
      font-size: 15px;
    }
  }
}

.btn-secondary {
  background: #E2E8F0;
  color: $cTextDark;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;

  &:hover {
    background: #CBD5E0;
  }
}

// ===========================
// CAMPAIGNS PAGE
// ===========================
.campaigns-page {
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;

  .campaigns-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;

    h2 {
      margin: 0;
      font-size: 20px;
      font-weight: 600;
      color: $cTextDark;

      i {
        color: $cPrimary;
        margin-right: 8px;
      }
    }
  }

  .campaigns-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;

    .filter-group {
      flex: 1;
      min-width: 0;

      label {
        display: block;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #8899A6;
        margin-bottom: 6px;

        i {
          margin-right: 4px;
        }
      }

      .form-control {
        width: 100%;
        padding: 10px 14px;
        border: 1px solid $cBorder;
        border-radius: 8px;
        font-size: 14px;
        color: $cTextDark;
        background: $cWhite;
        transition: border-color 0.2s;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238899A6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 32px;

        &:focus {
          outline: none;
          border-color: $cPrimary;
          box-shadow: 0 0 0 3px rgba($cPrimary, 0.1);
        }
      }

      .filter-with-action {
        display: flex;
        align-items: center;
        gap: 8px;

        .form-control {
          flex: 1;
        }

        .btn-icon {
          flex-shrink: 0;
          width: 42px;
          height: 42px;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          border-radius: 8px;
          border: none;
          cursor: pointer;
          font-size: 14px;
          transition: all 0.2s;

          &.btn-icon-delete {
            background: #FFF5F5;
            color: $cDanger;

            &:hover {
              background: $cDanger;
              color: $cWhite;
            }
          }
        }
      }
    }

    .filter-group-campaign-multi {
      flex: 2 !important;
    }

    .campaign-dropdown {
      flex: 1;
      min-width: 0;
      position: relative;
    }

    .campaign-dropdown-trigger {
      width: 100%;
      padding: 10px 14px;
      padding-right: 32px;
      border: 1px solid $cBorder;
      border-radius: 8px;
      font-size: 14px;
      color: $cTextDark;
      background: $cWhite;
      cursor: pointer;
      display: flex;
      align-items: center;
      transition: border-color 0.2s;
      position: relative;
      min-height: 42px;
      box-sizing: border-box;

      .campaign-dropdown-text {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        &.is-placeholder {
          color: #8899A6;
        }
      }

      .campaign-dropdown-arrow {
        position: absolute;
        right: 12px;
        font-size: 10px;
        color: #8899A6;
        transition: transform 0.2s;
      }
    }

    .campaign-dropdown.is-open {
      .campaign-dropdown-trigger {
        border-color: $cPrimary;
        box-shadow: 0 0 0 3px rgba($cPrimary, 0.1);
      }

      .campaign-dropdown-arrow {
        transform: rotate(180deg);
      }

      .campaign-dropdown-menu {
        display: block;
      }
    }

    .campaign-dropdown-menu {
      display: none;
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      z-index: 100;
      max-height: 280px;
      overflow-y: auto;
      background: $cWhite;
      border: 1px solid $cBorder;
      border-radius: 8px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      padding: 4px 0;
    }

    .campaign-dropdown-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      cursor: pointer;
      font-size: 14px;
      color: $cTextDark;
      margin: 0;
      transition: background 0.15s;

      &:hover {
        background: #F8FAFC;
      }

      &.is-checked {
        background: #EEF2FF;
      }

      input[type="checkbox"] {
        width: 16px;
        height: 16px;
        cursor: pointer;
        flex-shrink: 0;
        accent-color: $cPrimary;
      }

      span {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }

  .campaigns-list-panel {
    background: $cWhite;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    overflow: hidden;

    .campaigns-list-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      border-bottom: 1px solid $cBorder;
      gap: 12px;

      &-left {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        color: $cText;

        input[type="checkbox"] {
          width: 16px;
          height: 16px;
          cursor: pointer;
        }

        label {
          cursor: pointer;
          user-select: none;
          margin: 0;
        }

        .campaigns-selected-count {
          margin-left: 12px;
          color: #8899A6;
        }
      }

      &-right {
        .campaigns-bulk-delete-btn {
          display: inline-flex;
          align-items: center;
          gap: 6px;
          padding: 8px 16px;
          border: none;
          border-radius: 8px;
          font-size: 13px;
          font-weight: 600;
          cursor: pointer;
          background: #FFF5F5;
          color: $cDanger;
          transition: all 0.2s;

          &:hover:not(:disabled) {
            background: $cDanger;
            color: $cWhite;
          }

          &:disabled {
            opacity: 0.4;
            cursor: not-allowed;
          }
        }
      }
    }

    .campaigns-list-items {
      display: flex;
      flex-wrap: wrap;
      gap: 0;
      padding: 8px 8px;
      max-height: 220px;
      overflow-y: auto;

      .campaigns-list-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 12px;
        margin: 2px;
        border-radius: 6px;
        font-size: 13px;
        color: $cTextDark;
        cursor: pointer;
        user-select: none;
        transition: background 0.15s;

        &:hover {
          background: #F0F4FF;
        }

        input[type="checkbox"] {
          width: 15px;
          height: 15px;
          cursor: pointer;
          flex-shrink: 0;
        }

        .campaigns-list-item-name {
          white-space: nowrap;
        }
      }
    }
  }

  .campaigns-chart-wrap {
    background: $cWhite;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 20px;
    margin-bottom: 20px;
    min-height: 350px;
    overflow: hidden;

    #container {
      max-width: 100%;
    }
  }

  .campaigns-table-wrap {
    .table {
      width: 100%;
    }
  }

  .delete-history-entry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    background: #FFF5F5;
    color: $cDanger;
    transition: all 0.2s;

    &:hover {
      background: $cDanger;
      color: $cWhite;
    }
  }
}

// ===========================
// PRODUCTS PAGE
// ===========================
.products-page {
  .products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;

    h2 {
      margin: 0;
      font-size: 20px;
      font-weight: 600;
      color: $cTextDark;

      i {
        color: $cPrimary;
        margin-right: 8px;
      }
    }
  }

  .products-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 16px;

    .filter-group {
      flex: 1 1 220px;
      min-width: 0;

      label {
        display: block;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #8899A6;
        margin-bottom: 6px;

        i {
          margin-right: 4px;
        }
      }

      .form-control {
        width: 100%;
        padding: 10px 14px;
        border: 1px solid $cBorder;
        border-radius: 8px;
        font-size: 14px;
        color: $cTextDark;
        background: $cWhite;
        transition: border-color 0.2s;

        &:focus {
          outline: none;
          border-color: $cPrimary;
          box-shadow: 0 0 0 3px rgba($cPrimary, 0.1);
        }
      }

      select.form-control {
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238899A6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 32px;
      }

      &.filter-group-client,
      &.filter-group-campaign,
      &.filter-group-ad-group {
        flex: 1 1 260px;
      }

      &.filter-group-ad-group {
        .ad-group-filter-actions {
          display: flex;
          gap: 8px;
          align-items: center;

          .form-control {
            flex: 1 1 auto;
            min-width: 0;
          }
        }

        #delete-products-ad-group {
          min-width: 38px;
          height: 38px;
          border-radius: 6px;
          margin: 0;
          background: #dc3545;
          border: 1px solid #dc3545;
          color: #fff;
          cursor: pointer;

          &:hover:not(:disabled) {
            background: #bb2d3b;
            border-color: #bb2d3b;
            color: #fff;
          }

          &:disabled {
            opacity: 0.45;
            cursor: default;
            background: #dc3545;
            border-color: #dc3545;
            color: #fff;
          }
        }
      }

      &.filter-group-roas {
        flex: 0 0 200px;
      }

      &.filter-group-search {
        flex: 1 1 200px;
      }

      &.filter-group-cl4 {
        flex: 0 0 160px;
      }

      &.filter-group-columns {
        flex: 0 0 240px;
      }
    }
  }

  .products-scope-alerts {
    margin-bottom: 12px;
    border: 1px solid #FECACA;
    background: #FEF2F2;
    border-radius: 8px;
    overflow: hidden;

    summary {
      cursor: pointer;
      list-style: none;
      padding: 10px 12px;
      font-size: 13px;
      font-weight: 600;
      color: #991B1B;
      display: flex;
      align-items: center;
      gap: 8px;

      &::-webkit-details-marker {
        display: none;
      }
    }

    .products-scope-alerts-list {
      border-top: 1px solid #FECACA;
      background: #FFF;
      max-height: 260px;
      overflow: auto;
    }

    .products-scope-alert-item {
      padding: 10px 12px;
      border-bottom: 1px solid #F1F5F9;

      &:last-child {
        border-bottom: none;
      }
    }

    .products-scope-alert-meta {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
      font-size: 11px;
      color: #64748B;
    }

    .products-scope-alert-type {
      display: inline-flex;
      align-items: center;
      padding: 2px 6px;
      border-radius: 999px;
      background: #EEF2FF;
      color: #4338CA;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }

    .products-scope-alert-message {
      font-size: 13px;
      color: $cTextDark;
      line-height: 1.45;
    }
  }

  .products-actions {
    margin-bottom: 12px;

    .btn-danger {
      padding: 7px 14px;
      font-size: 13px;
      border-radius: 6px;
      border: none;
      cursor: pointer;
      transition: all 0.2s;

      &:disabled {
        opacity: 0.4;
        cursor: default;
      }
    }
  }

  .products-table-wrap {
    .table {
      width: 100%;

      // Kompaktowe inputy w tabeli
      input.min_roas,
      input.form-control-sm,
      select.custom_label_4,
      select.form-control-sm {
        padding: 3px 6px;
        font-size: 12px;
        border: 1px solid $cBorder;
        border-radius: 4px;
        background: $cWhite;
      }
    }
  }

  // Przycisk usuwania w wierszu
  .delete-product {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    background: #FFF5F5;
    color: $cDanger;
    transition: all 0.2s;

    &:hover {
      background: $cDanger;
      color: $cWhite;
    }
  }

  // Przycisk edycji w wierszu
  .edit-product-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    background: #EEF2FF;
    color: $cPrimary;
    transition: all 0.2s;

    &:hover {
      background: $cPrimary;
      color: $cWhite;
    }
  }
}

// --- Popup edycji produktu: AI suggest ---
.desc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;

  label {
    margin: 0;
  }
}

.desc-tabs {
  display: flex;
  gap: 2px;
  background: #eee;
  border-radius: 6px;
  padding: 2px;
}

.desc-tab {
  border: none;
  background: transparent;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  color: #666;
  transition: all .15s ease;

  i {
    margin-right: 4px;
  }

  &.active {
    background: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    font-weight: 500;
  }

  &:hover:not(.active) {
    color: #333;
  }
}

.desc-wrap {
  flex: 1;
  min-width: 0;
}

.desc-preview {

  ul,
  ol {
    margin: 6px 0;
    padding-left: 20px;
  }

  li {
    margin-bottom: 3px;
  }

  b,
  strong {
    font-weight: 600;
  }
}

.input-with-ai {
  display: flex;
  gap: 8px;
  align-items: flex-start;

  .form-control {
    flex: 1;
  }
}

.btn-ai-suggest {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #C084FC;
  background: linear-gradient(135deg, #F3E8FF, #EDE9FE);
  color: #7C3AED;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 38px;

  i {
    font-size: 13px;
  }

  &:hover {
    background: linear-gradient(135deg, #7C3AED, #6D28D9);
    color: #FFF;
    border-color: #6D28D9;
  }

  &:disabled {
    opacity: 0.7;
    cursor: wait;
  }

  &.btn-ai-claude {
    border-color: #D97706;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;

    &:hover {
      background: linear-gradient(135deg, #D97706, #B45309);
      color: #FFF;
      border-color: #B45309;
    }
  }

  &.btn-ai-gemini {
    border-color: #4285F4;
    background: linear-gradient(135deg, #E8F0FE, #D2E3FC);
    color: #1A73E8;

    &:hover {
      background: linear-gradient(135deg, #4285F4, #1A73E8);
      color: #FFF;
      border-color: #1A73E8;
    }
  }
}

// --- Form container ---
.form_container {
  background: $cWhite;
  padding: 25px;
  max-width: 1300px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

  &.full {
    max-width: 100%;
  }

  .form_group {
    margin-bottom: 12px;
    display: flex;

    >.label {
      width: 300px;
      display: inline-flex;
      align-items: flex-start;
      justify-content: right;
      padding-right: 12px;
    }

    .input {
      width: calc(100% - 300px);
    }
  }
}

// --- Default popup ---
.default_popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  z-index: 2000;

  .popup_content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: $cWhite;
    padding: 25px;
    border-radius: 10px;
    max-width: 1140px;
    width: 95%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);

    .popup_header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;

      .title {
        font-size: 18px;
        font-weight: 600;
      }
    }

    .close {
      cursor: pointer;
      color: #A0AEC0;
      font-size: 18px;
      padding: 4px;

      &:hover {
        color: $cDanger;
      }
    }
  }
}

// --- DataTables override ---
.dt-layout-table {
  margin-bottom: 20px;
}

.pagination {
  button {
    border: 1px solid $cBorder;
    background: $cWhite;
    display: inline-flex;
    height: 32px;
    width: 32px;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;

    &:hover {
      background: $cContentBg;
      border-color: $cPrimary;
    }
  }
}

// ===========================
// PRODUCTS specific
// ===========================
table#products {
  a {
    color: inherit;
    text-decoration: none;
  }

  .table-product-title {
    display: flex;
    justify-content: space-between;
  }

  .edit-product-title {
    display: flex;
    height: 25px;
    align-items: center;
    justify-content: center;
    width: 25px;
    cursor: pointer;
    background: $cWhite;
    border: 1px solid #CBD5E0;
    color: #CBD5E0;
    border-radius: 4px;

    &:hover {
      background: #CBD5E0;
      color: $cWhite;
    }
  }

  a.custom_name {
    color: $cGreenLight !important;
  }
}

// --- Product history ---
.product-history-page {
  .product-history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;

    span {
      display: inline-flex;
      align-items: center;
      padding: 5px 10px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 600;
      color: $cText;
      background: #EEF2FF;
      border: 1px solid #D9E2FF;
    }
  }

  .product-history-chart-wrap {
    background: $cWhite;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 20px;
    margin-bottom: 16px;
  }

  .chart-with-form {
    display: flex;
    gap: 20px;
    align-items: flex-start;
  }

  .chart-area {
    flex: 1 1 auto;
    min-width: 0;
  }

  .product-history-chart {
    min-height: 360px;
  }

  .comment-form {
    width: 340px;
    flex: 0 0 340px;
    background: #F8FAFC;
    border: 1px solid $cBorder;
    border-radius: 10px;
    padding: 14px;

    .form-group {
      margin-bottom: 12px;
    }

    label {
      display: block;
      font-weight: 600;
      margin-bottom: 6px;
      font-size: 13px;
      color: #52606D;
    }

    input[type="date"],
    textarea {
      width: 100%;
      border: 1px solid $cBorder;
      border-radius: 6px;
      padding: 8px 12px;
      font-size: 14px;
      font-family: "Roboto", sans-serif;
      background: $cWhite;

      &:focus {
        outline: none;
        border-color: $cPrimary;
        box-shadow: 0 0 0 3px rgba($cPrimary, 0.1);
      }
    }

    textarea {
      min-height: 110px;
      resize: vertical;
    }

    .btn {
      width: 100%;
      justify-content: center;
      padding: 10px 16px;
    }

    .btn[disabled] {
      opacity: 0.6;
      cursor: not-allowed;
    }
  }

  .products-table-wrap {
    overflow-x: auto;

    .table {
      min-width: 980px;
    }

    .comment-cell {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .comment-text {
      word-break: break-word;
    }

    .delete-comment {
      color: $cDanger;
      text-decoration: none;
      font-weight: 600;
      white-space: nowrap;

      &:hover {
        text-decoration: underline;
      }
    }

    .dt-paging .pagination .page-item {
      list-style: none;
    }
  }
}

.cron-status-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 20px;
  color: $cText;
  font-size: 13px;
}

.cron-progress-list {
  margin-bottom: 20px;
}

.cron-schedule-list {
  margin-bottom: 20px;
}

.cron-schedule-item {
  border: 1px solid #DFE7F0;
  background: #F4F8FD;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 8px;

  &:last-child {
    margin-bottom: 0;
  }

  strong {
    display: block;
    color: $cTextDark;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 2px;
  }

  small {
    display: block;
    color: #667788;
    font-size: 12px;
    line-height: 1.35;
  }
}

.cron-progress-item {
  margin-bottom: 14px;

  &:last-child {
    margin-bottom: 0;
  }

  .cron-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 13px;

    strong {
      color: $cTextDark;
      font-weight: 600;
    }

    span {
      color: #6B7A89;
      font-size: 12px;
      font-weight: 600;
      white-space: nowrap;
    }
  }

  small {
    display: block;
    margin-top: 5px;
    color: #778899;
    font-size: 12px;
  }
}

.cron-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #E9EEF5;
  overflow: hidden;

  >span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #5A9BFF 0%, #2E6BDF 100%);
  }
}

.cron-url-list {
  margin-bottom: 20px;
}

.cron-url-item {
  border: 1px solid $cBorder;
  border-radius: 8px;
  background: #F8FAFC;
  padding: 10px 12px;
  margin-bottom: 10px;

  &:last-child {
    margin-bottom: 0;
  }

  .cron-url-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;

    strong {
      color: $cTextDark;
      font-size: 13px;
      font-weight: 600;
    }

    small {
      color: #7A8794;
      font-size: 11px;
      white-space: nowrap;
    }
  }

  code {
    display: block;
    background: #EEF2F7;
    border: 1px solid #DDE4ED;
    border-radius: 6px;
    padding: 6px 8px;
    color: #2E3B49;
    font-size: 12px;
    overflow-x: auto;
  }

  .cron-url-plan {
    display: block;
    color: #6C7B8A;
    font-size: 11px;
    margin-bottom: 6px;
  }
}

@media (max-width: 1200px) {
  .product-history-page {
    .chart-with-form {
      flex-direction: column;
    }

    .comment-form {
      width: 100%;
      flex: 1 1 auto;
    }
  }
}

// --- Select2 w modalu ---
.jconfirm-box .form-group .select2-container,
.adspro-dialog-box .form-group .select2-container {
  width: 100% !important;
  margin-top: 8px;
}

.jconfirm-box .select2-container--default .select2-selection--single,
.adspro-dialog-box .select2-container--default .select2-selection--single {
  background-color: $cWhite;
  border: 1px solid $cBorder;
  border-radius: 6px;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 4px 12px;
  box-shadow: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 14px;
}

.jconfirm-box .select2-container--default .select2-selection--single .select2-selection__rendered,
.adspro-dialog-box .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 0;
  line-height: 1.4;
  color: #495057;
}

.jconfirm-box .select2-container--default .select2-selection--single .select2-selection__placeholder,
.adspro-dialog-box .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #CBD5E0;
}

.jconfirm-box .select2-container--default .select2-selection--single .select2-selection__arrow,
.adspro-dialog-box .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 8px;
}

.jconfirm-box .select2-container--default.select2-container--focus .select2-selection--single,
.jconfirm-box .select2-container--default .select2-selection--single:hover,
.adspro-dialog-box .select2-container--default.select2-container--focus .select2-selection--single,
.adspro-dialog-box .select2-container--default .select2-selection--single:hover {
  border-color: $cPrimary;
  box-shadow: 0 0 0 3px rgba($cPrimary, 0.1);
  outline: 0;
}

.jconfirm-box .select2-container .select2-dropdown,
.adspro-dialog-box .select2-container .select2-dropdown {
  border-color: $cBorder;
  border-radius: 0 0 6px 6px;
  font-size: 14px;
}

.jconfirm-box .select2-container .select2-search--dropdown .select2-search__field,
.adspro-dialog-box .select2-container .select2-search--dropdown .select2-search__field {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid $cBorder;
  font-size: 14px;
}

.jconfirm-box .select2-container--default .select2-results__option--highlighted[aria-selected],
.adspro-dialog-box .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: $cPrimary;
  color: $cWhite;
}

// ===========================
// RESPONSYWNOŚĆ
// ===========================
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);

    &.mobile-open {
      transform: translateX(0);
    }
  }

  .main-wrapper {
    margin-left: 0 !important;
  }
}

// ===========================
// CAMPAIGN TERMS VIEW
// ===========================
.campaign-terms-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.campaign-terms-page {
  max-width: 100%;
  overflow: hidden;

  .campaigns-filters {
    flex-wrap: wrap;

    .filter-group {
      min-width: 220px;

      &.terms-columns-group {
        min-width: 280px;
      }
    }
  }

  .terms-card-toggle {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: #FFFFFF;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: #F8FAFC;
      border-color: #CBD5E1;
    }
  }

  .terms-adgroups-card.is-collapsed .campaigns-extra-table-wrap {
    display: none;
  }

  .terms-search-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #EEF2F7;
    background: #FFFFFF;

    label {
      font-size: 12px;
      font-weight: 600;
      color: #475569;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin: 0;
      white-space: nowrap;
    }

    .terms-search-toolbar-label {
      min-width: 86px;
    }

    #terms_min_clicks_all,
    #terms_max_clicks_all {
      width: 160px;
      height: 32px;
    }

    #terms_min_conversions_all,
    #terms_max_conversions_all {
      width: 130px;
      max-width: 130px;
    }
  }

  .terms-search-selected-label {
    margin: 0;
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
  }

  .terms-ai-analyze-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #BFDBFE;
    background: #EFF6FF;
    color: #1D4ED8;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: #DBEAFE;
      border-color: #93C5FD;
    }

    &:disabled {
      opacity: 0.6;
      cursor: wait;
    }
  }

  .terms-table-search-input {
    width: 200px;
    min-width: 120px;
    max-width: 200px;
    height: 32px;
    font-size: 12px;
    flex: 0 1 200px;
  }

  .terms-negative-toolbar,
  .terms-keywords-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #EEF2F7;
    background: #FFFFFF;
  }

  .terms-negative-bulk-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #FECACA;
    background: #FEF2F2;
    color: #DC2626;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: #FEE2E2;
      border-color: #FCA5A5;
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }

  table.campaigns-extra-table>thead>tr>th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #111827 !important;
    color: #E5E7EB !important;
    border-bottom: 1px solid #0B1220 !important;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 10px 12px;
    white-space: nowrap;
  }

  #terms_search_table thead th .dt-column-order,
  #terms_negative_table thead th .dt-column-order {
    display: none !important;
  }

  #terms_search_table thead th.dt-orderable-asc,
  #terms_search_table thead th.dt-orderable-desc,
  #terms_negative_table thead th.dt-orderable-asc,
  #terms_negative_table thead th.dt-orderable-desc {
    cursor: pointer;
    padding-right: 34px;
    overflow: hidden;
  }

  #terms_search_table thead th .dt-column-title,
  #terms_negative_table thead th .dt-column-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 2px;
  }

  #terms_search_table thead th.dt-orderable-asc::after,
  #terms_search_table thead th.dt-orderable-desc::after,
  #terms_negative_table thead th.dt-orderable-asc::after,
  #terms_negative_table thead th.dt-orderable-desc::after {
    content: '\2195';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    color: #E5E7EB;
    background: #374151;
  }

  #terms_search_table thead th.dt-ordering-asc::after,
  #terms_negative_table thead th.dt-ordering-asc::after,
  #terms_search_table thead th[aria-sort="ascending"]::after,
  #terms_negative_table thead th[aria-sort="ascending"]::after {
    content: '\25B2';
    color: #FFFFFF;
    background: #2563EB;
  }

  #terms_search_table thead th.dt-ordering-desc::after,
  #terms_negative_table thead th.dt-ordering-desc::after,
  #terms_search_table thead th[aria-sort="descending"]::after,
  #terms_negative_table thead th[aria-sort="descending"]::after {
    content: '\25BC';
    color: #FFFFFF;
    background: #2563EB;
  }

  #terms_negative_select_all,
  .terms-negative-select-row,
  #terms_search_select_all,
  .terms-search-select-row {
    width: 14px;
    height: 14px;
    cursor: pointer;
  }

  .dt-layout-row:first-child {
    display: none;
  }

  .dt-layout-row {
    padding: 10px 12px;
    margin: 0 !important;
    border-top: 1px solid #F1F5F9;
  }

  .dt-info {
    font-size: 12px;
    color: #64748B;
  }

  .dt-paging .pagination {
    margin: 0;
    padding: 0;
    list-style: none !important;
    display: flex;
    align-items: center;
    gap: 6px;

    .page-item {
      list-style: none !important;

      .page-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        width: fit-content;
        height: 32px;
        padding: 0 12px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 500;
        border: 1px solid #E2E8F0;
        background: #FFFFFF;
        color: #4E5E6A;
        text-decoration: none;
        line-height: 1;
        white-space: nowrap;

        &:hover {
          background: #EEF2FF;
          color: #6690F4;
          border-color: #6690F4;
        }
      }

      &.previous .page-link,
      &.next .page-link {
        min-width: 72px;
      }

      &.active .page-link {
        background: #6690F4;
        color: #FFFFFF;
        border-color: #6690F4;
      }

      &.disabled .page-link {
        opacity: 0.35;
        cursor: default;
        pointer-events: none;
      }
    }
  }
}

.terms-columns-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.terms-columns-control {
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  background: #FFFFFF;
  overflow: hidden;

  summary {
    cursor: pointer;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    &::after {
      content: '\25BC';
      float: right;
      font-size: 10px;
      color: #64748B;
      margin-top: 2px;
    }
  }

  &[open] summary::after {
    content: '\25B2';
  }
}

.terms-columns-list {
  border-top: 1px solid #EEF2F7;
  padding: 8px 10px;
  max-height: 180px;
  overflow-y: auto;

  .terms-col-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #334155;
    margin-bottom: 6px;

    &:last-child {
      margin-bottom: 0;
    }

    input[type=checkbox] {
      margin: 0;
    }
  }
}

.campaigns-extra-card {
  background: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.campaigns-extra-card-title {
  padding: 14px 16px;
  border-bottom: 1px solid #E2E8F0;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;

  .terms-card-title-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
}

.campaigns-extra-table-wrap {
  overflow: auto;
}

.campaigns-extra-table {
  margin: 0;
  width: 100%;
  table-layout: fixed;

  tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid #F1F5F9;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
    white-space: nowrap;
  }

  td.num-cell {
    text-align: right;
    white-space: nowrap;
  }

  td.text-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  th.terms-negative-select-cell,
  td.terms-negative-select-cell,
  th.terms-search-select-cell,
  td.terms-search-select-cell {
    text-align: center;
  }

  th.phrase-nowrap,
  td.phrase-nowrap {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .terms-add-negative-btn,
  .terms-remove-negative-btn,
  .terms-delete-keyword-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .terms-add-negative-btn {
    border: 1px solid #E2E8F0;
    background: #EEF2FF;
    color: #3B82F6;

    &:hover {
      background: #3B82F6;
      color: #FFFFFF;
      border-color: #3B82F6;
    }
  }

  .terms-remove-negative-btn,
  .terms-delete-keyword-btn {
    border: 1px solid #FECACA;
    background: #FEF2F2;
    color: #DC2626;

    &:hover {
      background: #DC2626;
      color: #FFFFFF;
      border-color: #DC2626;
    }
  }

  .terms-toggle-keyword-status-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #FDE68A;
    background: #FFFBEB;
    color: #D97706;

    &:hover {
      background: #D97706;
      color: #FFFFFF;
      border-color: #D97706;
    }

    &.text-success {
      border-color: #A7F3D0;
      background: #ECFDF5;
      color: #059669;

      &:hover {
        background: #059669;
        color: #FFFFFF;
        border-color: #059669;
      }
    }
  }

  .terms-change-match-type-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #E2E8F0;
    background: #EEF2FF;
    color: #3B82F6;

    &:hover {
      background: #3B82F6;
      color: #FFFFFF;
      border-color: #3B82F6;
    }
  }

  tbody tr:hover {
    background: #F8FAFC;
  }

  tbody tr.term-is-negative td {
    color: #DC2626;
  }

  tbody tr.term-is-negative:hover {
    background: #FEF2F2;
  }
}

.campaigns-empty-row {
  text-align: center;
  color: #94A3B8 !important;
  font-style: italic;
}

.terms-ai-modal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;

  label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin: 0;
  }

  .form-control {
    width: 200px;
    height: 32px;
  }
}

.terms-ai-summary {
  font-size: 12px;
  color: #64748B;
  margin-bottom: 10px;
}

.terms-ai-results-wrap {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  max-height: 420px;
  overflow: auto;
}

.terms-ai-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;

  th,
  td {
    border-bottom: 1px solid #EEF2F7;
    padding: 8px;
    vertical-align: middle;
  }

  th {
    position: sticky;
    top: 0;
    background: #F8FAFC;
    color: #334155;
    font-weight: 700;
  }

  td.term-col {
    min-width: 260px;
    max-width: 380px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  td.reason-col {
    min-width: 320px;
  }
}

.terms-ai-action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;

  &.action-exclude {
    background: #FEE2E2;
    color: #B91C1C;
  }

  &.action-keep {
    background: #DCFCE7;
    color: #166534;
  }
}

// ===========================
// PRODUCTS VIEW (INLINE MOVED)
// ===========================
.products-page .products-filters .filter-group.filter-group-columns {
  min-width: 240px;
}

.products-columns-control {
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  background: #FFFFFF;
  overflow: hidden;

  summary {
    cursor: pointer;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    &::after {
      content: '\25BC';
      float: right;
      font-size: 10px;
      color: #64748B;
      margin-top: 2px;
    }
  }

  &[open] summary::after {
    content: '\25B2';
  }
}

.products-columns-list {
  border-top: 1px solid #EEF2F7;
  padding: 8px 10px;
  max-height: 220px;
  overflow-y: auto;

  .products-col-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #334155;
    margin-bottom: 6px;

    &:last-child {
      margin-bottom: 0;
    }

    input[type=checkbox] {
      margin: 0;
    }
  }
}

#products {

  th:last-child,
  td:last-child {
    white-space: nowrap;
  }

  tr.product-row-unavailable {
    opacity: 0.45;

    td {
      background-color: #f0f0f0 !important;
    }
  }

  .product-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #DC2626;
    font-size: 16px;

    &:hover {
      color: #B91C1C;
    }
  }

  .products-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    .btn {
      width: 38px;
      height: 32px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px !important;

      i {
        line-height: 1;
      }
    }
  }
}

// ===========================
// LOGS PAGE
// ===========================
.logs-page {
  .logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;

    h2 {
      margin: 0;
      font-size: 20px;
      font-weight: 600;
      color: $cTextDark;
    }
  }

  .logs-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 16px;

    .filter-group {
      flex: 1 1 160px;
      min-width: 0;
      max-width: 220px;

      label {
        display: block;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #8899A6;
        margin-bottom: 6px;
      }

      .form-control {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid $cBorder;
        border-radius: 8px;
        font-size: 14px;
        color: $cTextDark;
        background: $cWhite;
        transition: border-color 0.2s;

        &:focus {
          outline: none;
          border-color: $cPrimary;
          box-shadow: 0 0 0 3px rgba($cPrimary, 0.1);
        }
      }

      select.form-control {
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238899A6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 32px;
      }

      &.filter-group-buttons {
        flex: 0 0 auto;
        display: flex;
        gap: 6px;
        max-width: none;
      }
    }
  }

  .logs-table-wrap {
    .table {
      width: 100%;
    }
  }

  .badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .badge-success {
    background: #D1FAE5;
    color: #065F46;
  }

  .badge-danger {
    background: #FEE2E2;
    color: #991B1B;
  }

  .badge-warning {
    background: #FEF3C7;
    color: #92400E;
  }
}

.js-title-alt-apply {
  color: #000;
  justify-content: flex-start;
}