/* Header i kontrolki unikalne dla sekcji */

/* Dostępność: jednolity focus dla przycisków */
[class*="btn"]:focus-visible,
[class*="button"]:focus-visible,
button:focus-visible,
input[type="button"]:focus-visible,
input[type="submit"]:focus-visible {
  outline: 2px solid #003d82;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0, 61, 130, 0.25);
}

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

/* Panel statystyk */
.stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 1.25rem;
}

.stat-box {
  background: #fff;
  border-radius: 8px;
  padding: 0.625rem 0.9375rem 0.625rem 0.9375rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  padding: 0.625rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
}

.stat-content {
  flex-grow: 1;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
}

.stat-label {
  font-size: 14px;
  color: #666;
}

/* .listings-controls i .listings-controls-left - definicje w listings.css */

.sort-control {
  padding: 0.625rem 2rem 0.625rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.1s ease;
  min-width: 200px;
}

.filter-buttons {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  color: #656565;
  cursor: pointer;
}

.filter-btn.active {
  background: #003153;
  color: white;
  border-color: #003153;
}

/* Definicja .listing-meta w components.css */

.listing-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Bazowa definicja .badge w components.css */

/* Warianty badge dla user-listings */
.badge.featured {
  background: #fff3dc;
  color: #b25e09;
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  font-weight: 500;
}

.badge.promoted {
  background: #ecfdf5;
  color: #065f46;
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  font-weight: 500;
}

.badge.owner-email {
  background: #e8eaf6;
  color: #283593;
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  font-weight: 500;
}

.listing-status {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.listing-status.bg-success {
  background: #10b981;
  color: white;
}

.listing-status.bg-danger {
  background: #f3e8ff;
  color: #581c87;
}

.details-row {
  display: flex;
  color: #656565;
  font-size: 0.875rem;
}

/* Definicja .detail-item, .detail-item.saves w components.css */

/* Definicja .no-listings, .no-listings-content, .add-first-listing-btn w components.css */

.delete-icon {
  margin-bottom: 1rem;
  color: #dc2626;
  text-align: center;
}

.delete-message {
  font-size: 1.1rem;
  color: #374151;
  margin-bottom: 0.5rem;
  text-align: center;
}

.delete-warning {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0;
  text-align: center;
}

/* Style specyficzne dla sekcji ustawień - wykorzystujemy istniejące style gdzie to możliwe */

.settings-page-header {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid #dbe7f3;
  border-radius: 18px;
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 55%, #f5f7f9 100%);
}

.settings-page-header h1 {
  margin: 0;
  font-size: 32px;
  color: #003153;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

/* Layout specyficzny dla ustawień */
.settings-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 32px;
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Sidebar ustawień */
.settings-sidebar {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  height: fit-content;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

/* Content ustawień */
.settings-content {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  overflow-x: hidden;
}

.settings-nav {
  padding: 1rem 0.5rem;
}

.settings-nav-toggle {
  display: none;
}

.settings-nav-header {
  padding: 1rem;
  border-bottom: 1px solid #ddd;
}

.setting-separator {
  height: 1px;
  background: #ddd;
  margin: 1.25rem 0;
}

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

.user-name-row {
  display: flex;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.25rem;
}

.user-email {
  font-size: 14px;
  color: #6b7280;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  color: #4b5563;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  margin-bottom: 0.25rem;
}

body.account-recruiter .settings-nav .settings-nav-item.recruiter-only {
  display: flex !important;
}

.settings-nav .settings-nav-item.team-only {
  display: none !important;
}

body.account-team .settings-nav .settings-nav-item.team-only {
  display: flex !important;
}

body.account-team .settings-nav .settings-nav-item.recruiter-only {
  display: none !important;
}

body.account-recruiter .settings-tab.recruiter-only,
body.account-team .settings-tab.recruiter-only {
  display: none !important;
}

body.account-recruiter .settings-tab.recruiter-only.active {
  display: block !important;
}

.settings-tab.team-only {
  display: none !important;
}

body.account-team .settings-tab.team-only.active {
  display: block !important;
}

.settings-nav-item.active {
  background: #003153;
  color: white;
}

.settings-nav-item.danger {
  color: #dc2626;
}

/* Zawartość zakładek */
.settings-content,
.settings-tab {
  /* Domyślnie ukryj całą zawartość I Ukryj wszystkie taby */
  display: none;
}

.settings-content.active {
  display: block;
  /* Pokaż tylko aktywną zawartość */
}

.settings-tab.active {
  display: block;
  /* Pokaż aktywny tab */
  opacity: 1;
  height: auto;
  overflow: visible;
  pointer-events: auto;
  animation: fadeIn 0.3s ease;
}

/* Przełącznik motywu */
.theme-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.theme-option input {
  display: none;
}

.theme-preview {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.theme-sample {
  height: 80px;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.theme-preview.light .theme-sample {
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.theme-preview.dark .theme-sample {
  background: #1f2937;
}

.theme-preview.auto .theme-sample {
  background: linear-gradient(to right, #ffffff 50%, #1f2937 50%);
}

.theme-option input:checked+.theme-preview {
  border-color: #003153;
}

/* Switch - specyficzny dla ustawień */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e5e7eb;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: #003153;
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Style dla listy zapisanych kryteriów */
.saved-criteria-list {
  margin-top: 1rem;
}

.criteria-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.criteria-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.criteria-content {
  flex: 1;
}

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

.criteria-title {
  font-weight: 500;
  color: #374151;
}

.criteria-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.criteria-tag {
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 13px;
  color: #4b5563;
}

.criteria-actions {
  display: flex;
  gap: 8px;
}

.delete-criteria-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 0.875rem;
  color: #dc2626;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  transition: all 0.2s ease;
}

.delete-criteria-btn:hover {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

/* Responsywność */

@media (max-width: 1200px) {
  .stats-panel {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 0.9375rem;
  }

  .stat-box {
    padding: 0.75rem;
  }

  .stat-value {
    font-size: 18px;
  }

  .listings-controls {
    flex-wrap: wrap;
    gap: 15px;
  }

  .listings-controls-left {
    flex-wrap: nowrap;
    flex-grow: 1;
    align-items: center;
    gap: 15px;
  }

  .search-box {
    flex-grow: 1;
    max-width: 350px;
    min-width: 200px;
  }

  .filter-buttons {
    flex-shrink: 0;
  }

  /* Settings layout - responsywność 1200px */
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .settings-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem;
  }

  .settings-nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.375rem 0.75rem;
  }

  .criteria-item {
    padding: 0.875rem;
  }

  .criteria-title {
    font-size: 0.95em;
  }

  .criteria-tag {
    font-size: 13px;
  }

  .setting-separator {
    margin: 1rem 0;
  }

  #user-listings .listing-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  #user-listings .listing-meta {
    width: 100%;
    flex-wrap: wrap;
  }

  #user-listings .listing-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  #user-listings .listing-meta .details-row {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 992px) {

  .stat-box {
    padding: 0.625rem;
  }

  .settings-page-header {
    padding: 1rem;
    border-radius: 16px;
  }

  .settings-page-header h1 {
    font-size: 28px;
  }

  .settings-layout {
    gap: 16px;
  }

  .settings-nav-header {
    padding: 0.75rem 1rem;
  }

  .user-info {
    padding: 0 8px;
  }

  .filter-buttons {
    flex-wrap: wrap;
    gap: 16px;
  }

  .filter-btn {
    padding: 0.5rem 0.75rem;
    font-size: 13px;
  }

  .listings-controls-left {
    gap: 10px;
  }

  .search-box {
    max-width: 280px;
  }

  .criteria-tag {
    font-size: 12px;
  }

  .setting-separator {
    margin: 0.875rem 0;
  }

  .no-listings-content {
    padding: 1.5625rem;
    max-width: 550px;
  }
}

@media (max-width: 768px) {

  .header-main {
    flex-direction: column;
  }

  .settings-page-header {
    margin-bottom: 1rem;
    padding: 0.75rem;
  }

  .settings-page-header h1 {
    font-size: 26px;
  }

  .header-left,
  .header-right {
    flex-direction: column;
    align-items: center;
  }

  /* Hamburger menu dla settings */
  .settings-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0.75rem auto 6px;
    background:
      linear-gradient(currentColor, currentColor) 50% 35% / 22px 2px no-repeat,
      linear-gradient(currentColor, currentColor) 50% 50% / 22px 2px no-repeat,
      linear-gradient(currentColor, currentColor) 50% 65% / 22px 2px no-repeat,
      #ffffff;
    color: #213445;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
  }

  .settings-nav-toggle:hover {
    border-color: #d1d5db;
  }

  .settings-nav-toggle:focus-visible {
    outline: 2px solid #003d82;
    outline-offset: 2px;
  }

  /* Ukryj nav domyślnie na mobile */
  .settings-nav {
    display: none;
  }

  .settings-nav.is-open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    justify-content: stretch;
    justify-items: stretch;
    animation: slideDown 0.3s ease;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .settings-nav-item {
    font-size: 13px;
    gap: 6px;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 0.625rem 0.5rem;
    margin: 0;
    line-height: 1.2;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    touch-action: manipulation;
    white-space: normal;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-radius: 6px;
  }

  .settings-nav-item:hover,
  .settings-nav-item:focus-visible {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .settings-nav-item:focus-visible {
    outline: 2px solid #003d82;
    outline-offset: 2px;
  }

  .settings-nav-item.active {
    border-color: #003153;
  }

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

  .listing-footer {
    gap: 15px;
    padding-top: 0.9375rem;
  }

  .listing-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .saved-criteria-list {
    margin-top: 0.75rem;
  }

  .criteria-item {
    padding: 0.75rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .criteria-content {
    flex-grow: 1;
    display: flex;
    align-items: center;
  }

  .criteria-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 0;
  }

  .criteria-details {
    margin-top: 0.375rem;
  }

  .criteria-actions {
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
  }

  .delete-criteria-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.9375rem;
  }

  .no-listings-content {
    padding: 0.9375rem;
    width: 90%;
  }

  .criteria-title {
    margin: 0;
  }

  .setting-separator {
    margin: 0.75rem 0;
  }
}

@media (max-width: 576px) {
  .stat-box {
    padding: 0 8px;
  }

  .settings-page-header {
    padding: 0.625rem;
  }

  .settings-page-header h1 {
    font-size: 22px;
  }

  .stat-icon {
    padding: 0.5rem;
  }

  .stat-value {
    font-size: 16px;
  }

  .stat-label {
    font-size: 13px;
  }

  .filter-btn {
    padding: 0.375rem 0.75rem;
  }

  .filter-btn .count {
    font-size: 13px;
  }

  .settings-header h2 {
    font-size: 1.3em;
  }

  .criteria-item {
    padding: 0.625rem;
  }

  .criteria-title {
    font-size: 14px;
  }

  .delete-criteria-btn {
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    min-height: 52px;
  }

  .criteria-tag {
    padding: 0.1875rem 0.375rem;
  }

  .no-listings-content {
    padding: 1.25rem;
  }

  .no-listings-content h3 {
    font-size: 18px;
  }

  .no-listings-content p {
    font-size: 14px;
  }

  .add-first-listing-btn {
    padding: 0.625rem 1rem;
    font-size: 14px;
  }

  #user-listings .listing-meta .details-row .detail-item {
    flex-basis: calc(50% - 4px);
    /* Dwa elementy w rzędzie */
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Koniec dodanych stylów dla Moje Ogłoszenia */

  .listings-controls {
    gap: 10px;
  }

  .listings-controls-left {
    width: 100%;
    flex-wrap: wrap;
    order: 1;
  }

  .sort-control {
    width: auto;
    flex-grow: 1;
    min-width: 150px;
  }

  .search-box {
    width: auto;
    min-width: 150px;
    max-width: none;
  }

  .filter-buttons {
    width: 100%;
    justify-content: center;
    order: 2;
    margin-top: 0.625rem;
  }

  .btn-notification {
    order: 3;
  }
}

@media (max-width: 420px) {
  .stat-box {
    padding: 0 6px;
  }

  .settings-page-header {
    border-radius: 14px;
  }

  .settings-page-header h1 {
    font-size: 20px;
  }

  .stat-icon {
    padding: 0.375rem;
  }

  .stat-value {
    font-size: 15px;
  }

  .stat-label {
    font-size: 13px;
  }

  .filter-btn {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    box-sizing: border-box;
  }

  .no-listings-content h3 {
    font-size: 16px;
  }

  .add-first-listing-btn {
    padding: 0.625rem 1rem;
    font-size: 14px;
    min-height: 44px;
  }

  .settings-nav-item {
    padding: 0.75rem 0.75rem;
    align-items: center;
  }

  .settings-header h2 {
    font-size: 1.2em;
  }

  .delete-criteria-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    min-height: 52px;
  }

  .stats-panel {
    gap: 12px;
  }

  .listings-controls {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .listings-controls-left {
    flex-direction: column;
  }

  .sort-control {
    min-width: 0;
    /* Nadpisanie min-width: 200px */
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 16px;
    min-height: 44px;
    box-sizing: border-box;
  }

  .search-box {
    width: 100%;
    min-width: 0;
    /* Nadpisanie jakichkolwiek min-width */
  }

  .search-box input {
    padding: 0.5rem 0.75rem 0.5rem 2.1875rem;
    font-size: 16px;
    min-height: 44px;
    box-sizing: border-box;
    min-width: 0;
    /* Nadpisanie jakichkolwiek min-width */
  }

  .filter-buttons {
    gap: 6px;
  }

  .btn-notification {
    order: -1;
  }

  .filter-btn {
    gap: 4px;
  }

  .settings-layout {
    width: 100%;
    box-sizing: border-box;
  }

  .settings-sidebar {
    order: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .settings-nav.is-open {
    grid-template-columns: 1fr;
  }

  .settings-nav-item {
    margin-bottom: 0;
  }

  /* Poprawione style dla zawartości settings */
  .settings-content {
    order: 1;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 4px;
    /* Dodane bezpieczne padding */
  }

  .settings-tab {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 4px;
    overflow-x: hidden;
  }

  .settings-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .settings-form .form-group {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .settings-form .form-group input,
  .settings-form .form-group select,
  .settings-form .form-group textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .user-info {
    margin-bottom: 1rem;
  }

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

  .user-email {
    font-size: 13px;
  }

  .no-listings-content {
    padding: 1rem;
  }

  .add-first-listing-btn {
    padding: 0.625rem 1.25rem;
  }
}