/* --- Styl dla frontendu --- */

.mrep-tabs-frontend {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mrep-tabs-frontend .tab-link {
  padding: 12px 20px;
  background-color: var(--mrep-filter-btn-bg, #000000);
  border: var(--mrep-filter-btn-border-width, 0px) solid var(--mrep-filter-btn-border-color, #000000);
  text-decoration: none;
  color: var(--mrep-filter-btn-text, #ffffff);
  border-radius: var(--mrep-filter-btn-border-radius, 4px);
  transition: all 0.3s ease;
  font-weight: 500;
}

.mrep-tabs-frontend .tab-link:hover {
  background-color: var(--mrep-filter-btn-hover-bg, #333333);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mrep-tabs-frontend .tab-link.active {
  background-color: var(--mrep-filter-btn-hover-bg, #333333);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Modern filter form layout with better responsiveness */
#mrep-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
  align-items: flex-end;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mrep-filter-group {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  flex: 1 1 auto;
}

.mrep-filter-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.mrep-filter-group input,
.mrep-filter-group select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  background: white;
}

.mrep-filter-group input:focus,
.mrep-filter-group select:focus {
  outline: none;
  border-color: var(--mrep-filter-btn-bg, #000000);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.mrep-filter-group.slider-filter {
  min-width: 200px;
}

.mrep-filter-group.slider-filter .slider {
  margin-top: 15px;
  margin-bottom: 5px;
}

.mrep-filter-group.slider-filter .slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

/* Styled filter button with CSS variables */
.button_wraf {
  background-color: var(--mrep-filter-btn-bg, #000000) !important;
  color: var(--mrep-filter-btn-text, #ffffff) !important;
  border: var(--mrep-filter-btn-border-width, 0px) solid var(--mrep-filter-btn-border-color, #000000) !important;
  border-radius: var(--mrep-filter-btn-border-radius, 4px) !important;
  padding: 12px 30px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.3s ease !important;
  width: auto !important;
  height: auto !important;
  min-width: 120px;
}

.button_wraf:hover {
  background-color: var(--mrep-filter-btn-hover-bg, #333333) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Modern table styling with CSS variables from admin panel */
.mrep-apartment-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.mrep-apartment-table th,
.mrep-apartment-table td {
  border-style: var(--mrep-table-border-style, solid);
  border-width: var(--mrep-table-border-width, 1px);
  border-color: var(--mrep-table-border-color, #e0e0e0);
  padding: 14px 12px;
  text-align: left;
}

.mrep-apartment-table th {
  background-color: var(--mrep-table-header-bg, #f5f5f5);
  color: var(--mrep-table-header-text, #333333);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mrep-apartment-table tbody tr:nth-child(even) {
  background-color: var(--mrep-table-row-even-bg, #ffffff);
}

.mrep-apartment-table tbody tr:nth-child(odd) {
  background-color: var(--mrep-table-row-odd-bg, #f9f9f9);
}

.mrep-apartment-table tbody tr {
  transition: background-color 0.2s ease;
}

.mrep-apartment-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Floor plan thumbnail styling */
.mrep-apartment-table .floor-plan-thumbnail {
  max-width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 2px solid #e0e0e0;
}

.mrep-apartment-table .floor-plan-thumbnail:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--mrep-accent-color, #0073aa);
}

.mrep-apartment-table .image-cell a {
  display: inline-block;
}

.mrep-apartment-table img {
  max-width: 100px;
  height: auto;
  display: block;
}

.mrep-apartment-table .status-Wolne {
  background-color: transparent !important;
}

.mrep-apartment-table .status-Zarezerwowane {
  background-color: #fff8eb !important;
}

.mrep-apartment-table .status-Sprzedane {
  background-color: #f7eaea !important;
}

.mrep-apartment-table a img {
  width: 28px;
  height: 28px;
  transition: transform 0.2s ease;
}

.mrep-apartment-table a:hover img {
  transform: scale(1.1);
}

/* Modern button styles using CSS variables */
.mrep-history-btn {
  background-color: var(--mrep-history-btn-bg, #6c757d);
  color: var(--mrep-history-btn-text, #ffffff);
  border: none;
  padding: 6px 14px;
  border-radius: var(--mrep-history-btn-border-radius, 4px);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  margin-left: 8px;
}

.mrep-history-btn:hover {
  background-color: var(--mrep-history-btn-hover-bg, #5a6268);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.mrep-offer-btn {
  background-color: var(--mrep-offer-btn-bg, #bd9a72);
  color: var(--mrep-offer-btn-text, #ffffff);
  border: none;
  padding: 8px 18px;
  border-radius: var(--mrep-offer-btn-border-radius, 4px);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.mrep-offer-btn:hover {
  background-color: var(--mrep-offer-btn-hover-bg, #a8865f);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(189, 154, 114, 0.3);
}

/* Responsive table */
.table-responsive {
  overflow-x: auto;
  border-radius: 8px;
}

/* Improved mobile responsive design */
@media (max-width: 768px) {
  #mrep-filter-form {
    padding: 15px;
    gap: 15px;
  }

  .mrep-filter-group {
    min-width: 100%;
  }

  .button_wraf {
    width: 100% !important;
    padding: 12px 20px !important;
  }

  .mrep-apartment-table thead {
    display: none;
  }

  .mrep-apartment-table tr {
    border: 1px solid var(--mrep-table-border-color, #e0e0e0);
    margin-bottom: 15px;
    display: block;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .mrep-apartment-table td {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    border: none;
    padding: 10px 0 !important;
    text-align: right;
    gap: 10px;
  }

  .mrep-apartment-table td::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    min-width: 45%;
    color: #333;
  }

  .mrep-apartment-table td:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
  }

  /* Mobile styling for image cells */
  .mrep-apartment-table td.image-cell {
    flex-direction: column;
    align-items: flex-start;
  }

  .mrep-apartment-table td.image-cell .floor-plan-thumbnail {
    max-width: 100%;
    width: 100%;
    height: auto;
    margin-top: 8px;
  }
}

.mrep-apartment-table th {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.mrep-apartment-table th:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.mrep-apartment-table th .sort-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.2s ease-in-out;
  opacity: 0.5;
}

.mrep-apartment-table th:hover .sort-icon {
  opacity: 1;
}

.mrep-apartment-table th.sorted-asc .sort-icon {
  transform: translateY(-50%) rotate(180deg);
  opacity: 1;
}

.mrep-apartment-table th.sorted-desc .sort-icon {
  transform: translateY(-50%) rotate(0deg);
  opacity: 1;
}

/* Modern popup/modal styling */
.mrep-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.mrep-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 30px;
  border: none;
  width: 90%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: slideDown 0.3s ease;
}

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

.mrep-close-btn {
  color: #aaa;
  float: right;
  font-size: 32px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: color 0.3s ease;
}

.mrep-close-btn:hover,
.mrep-close-btn:focus {
  color: #000;
}

/* Styled form elements in modal */
.mrep-modal-content h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #333;
  font-size: 24px;
  font-weight: 600;
}

.mrep-modal-content p {
  margin: 10px 0;
  color: #666;
}

.mrep-modal-content .ned {
  margin-bottom: 18px;
}

.mrep-modal-content .ned label,
.mrep-modal-content .ned > text {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
}

.mrep-modal-content .ino {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.mrep-modal-content .ino:focus {
  outline: none;
  border-color: var(--mrep-offer-btn-bg, #bd9a72);
  box-shadow: 0 0 0 3px rgba(189, 154, 114, 0.1);
}

.mrep-modal-content .wyjjj {
  background-color: var(--mrep-offer-btn-bg, #bd9a72);
  color: var(--mrep-offer-btn-text, #ffffff);
  border: none;
  padding: 12px 30px;
  border-radius: var(--mrep-offer-btn-border-radius, 4px);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  margin-top: 20px;
  transition: all 0.3s ease;
}

.mrep-modal-content .wyjjj:hover {
  background-color: var(--mrep-offer-btn-hover-bg, #a8865f);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(189, 154, 114, 0.3);
}

/* Consent checkbox styling */
.mrep-consent-toggle {
  margin: 20px 0 10px;
}

.mrep-consent-toggle input[type="checkbox"] {
  margin-right: 8px;
}

.mrep-consent-toggle label {
  font-weight: 600;
  cursor: pointer;
}

.mrep-consents-details {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-top: 10px;
}

.mrep-consents-details .cjk {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mrep-consents-details input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

/* Success/Error messages */
.success-message,
.error-message {
  padding: 15px;
  border-radius: 6px;
  font-weight: 500;
  text-align: center;
}

.success-message {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.mrep-no-apartments {
  padding: 40px 20px;
  text-align: center;
  color: #666;
  font-size: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin: 20px 0;
}

/* Ukrycie kolumny ID w tabeli mieszkań */
.mrep-apartment-table th[data-sort-key="id"],
.mrep-apartment-table td:nth-child(1) {
  display: none !important;
}

/* jQuery UI Slider modern styling */
.ui-slider {
  height: 6px;
  background: #e0e0e0;
  border: none;
  border-radius: 3px;
}

.ui-slider-range {
  background: var(--mrep-filter-btn-bg, #000000);
  border-radius: 3px;
}

.ui-slider-handle {
  width: 18px;
  height: 18px;
  background: var(--mrep-filter-btn-bg, #000000);
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  top: -7px;
}

.ui-slider-handle:hover {
  transform: scale(1.1);
}

.ui-slider-handle:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
}

/* Additional responsiveness improvements */
@media (max-width: 991px) {
  .button_wraf {
    min-width: 150px !important;
    font-size: 14px !important;
  }

  .mrep-tabs-frontend {
    gap: 8px;
  }

  .mrep-tabs-frontend .tab-link {
    padding: 10px 15px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .mrep-modal-content {
    width: 95%;
    padding: 20px;
    margin: 10% auto;
  }

  .mrep-modal-content h3 {
    font-size: 20px;
  }
}

/* Cell content wrapper for better control */
.cell-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Flexbox helper */
.flexx {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

/* Additional admin panel styling elements */
.flex_nubers_nf {
  background: #f0f0f1;
  padding: 20px;
  border-radius: 6px;
  margin-top: 20px;
  line-height: 1.6;
}

.akceptuje_d {
  display: flex;
  align-items: center;
  gap: 10px;
}

.akc {
  margin-left: auto;
  color: #666;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rotates {
  transition: transform 0.3s ease;
}

/* PDF link styling */
.pdf-link {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.pdf-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.mrep-columns-list tr td:first-child {
  cursor: grab;
}

#mrep-tabs-container {
  border: 1px solid #ccc;
  padding: 20px;
}

.mrep-tabs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  border-bottom: 1px solid #ccc;
}

.mrep-tabs-list li {
  padding: 10px 15px;
  cursor: pointer;
  background: #f1f1f1;
  border: 1px solid #ccc;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  margin-right: 5px;
  position: relative;
}

.mrep-tabs-list li.active {
  background: #fff;
  border-bottom-color: #fff;
  z-index: 1;
}

.mrep-tabs-list li .remove-tab {
  position: absolute;
  right: 5px;
  top: 5px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.mrep-tabs-list #add-new-tab-btn {
  background-color: #e9e9e9;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
}

.mrep-tabs-content .tab-pane {
  display: none;
  padding-top: 20px;
}

.mrep-tabs-content .tab-pane.active {
  display: block;
}

.mrep-columns-repeater,
.mrep-apartments-repeater {
  margin-top: 20px;
}

.mrep-columns-repeater input,
.mrep-apartments-repeater input,
.mrep-apartments-repeater select {
  width: 100%;
  box-sizing: border-box;
}

.mrep-apartments-repeater button {
  margin-left: 5px;
}

.mrep-columns-repeater table td,
.mrep-apartments-repeater table td {
  vertical-align: middle;
}

#mrep-colors-section label {
  display: block;
  margin-bottom: 10px;
}

#mrep-colors-section label input {
  margin-left: 5px;
}

.input-with-button {
  display: flex;
}

.input-with-button input {
  flex-grow: 1;
}

.input-with-button button {
  width: auto;
  margin-left: 5px;
}

.mrep-table-wrapper {
  background-color: transparent;

  margin-top: 1vw;

  margin-bottom: 1vw;

  padding-left: 3vw;

  padding-right: 3vw;

  padding-bottom: 2vw;

  padding-top: 2vw;
}

.mrep-tabs-frontend {
  display: flex;

  gap: 1vw;

  margin-bottom: 2vw;

  align-items: center;

  justify-content: center;

  align-content: center;
}

.mrep-filter-group {
  border-right: 1px solid #ccc; /* линия справа */
}

.mrep-filter-group:last-child {
  border-right: none;
}

.historu {
  width: 1vw;
}

.mrep-history-btn {
  border: 0px !important;
}

/* Медиа-запрос для экранов от 991px, все значения в vw */

@media (min-width: 991px) {
  .mrep-table-wrapper {
    margin-top: 0.52vw; /* 10px / 19.2 */

    margin-bottom: 0.52vw; /* 10px / 19.2 */

    padding-left: 1.56vw; /* 30px / 19.2 */

    padding-right: 1.56vw; /* 30px / 19.2 */

    padding-bottom: 1.04vw; /* 20px / 19.2 */

    padding-top: 1.04vw; /* 20px / 19.2 */
  }

  .mrep-tabs-frontend {
    gap: 0.52vw; /* 10px / 19.2 */

    margin-bottom: 1.04vw; /* 20px / 19.2 */
  }

  .mrep-tabs-frontend .tab-link {
    padding: 0.52vw 0.78vw; /* 10px 15px / 19.2 */

    border: 0.052vw solid #ccc; /* 1px / 19.2 */

    border-radius: 0.26vw; /* 5px / 19.2 */
  }

  #mrep-filter-form {
    gap: 1.04vw; /* 20px / 19.2 */

    margin-bottom: 1.04vw; /* 20px / 19.2 */
  }

  .mrep-filter-group {
    max-width: 13.02vw; /* 250px / 19.2 */
  }

  .mrep-filter-group input,
  .mrep-filter-group select {
    padding: 0.42vw; /* 8px / 19.2 */

    border: 0.052vw solid #ccc; /* 1px / 19.2 */

    border-radius: 0.21vw; /* 4px / 19.2 */
  }

  .mrep-filter-group.slider-filter .slider {
    margin-top: 0.52vw; /* 10px / 19.2 */
  }

  .mrep-filter-group.slider-filter .slider-labels {
    margin-top: 0.26vw; /* 5px / 19.2 */
  }

  .mrep-apartment-table {
    margin-top: 1.04vw; /* 20px / 19.2 */
  }

  .mrep-apartment-table th,
  .mrep-apartment-table td {
    border: 0.052vw solid #ccc; /* 1px / 19.2 */

    padding: 0.52vw; /* 10px / 19.2 */
  }

  .mrep-apartment-table img {
    max-width: 5.21vw; /* 100px / 19.2 */
  }

  .mrep-apartment-table a img {
    width: 1.25vw; /* 24px / 19.2 */

    height: 1.25vw; /* 24px / 19.2 */
  }

  .mrep-apartment-table .history-button img {
    width: 0.83vw; /* 16px / 19.2 */

    height: 0.83vw; /* 16px / 19.2 */
  }

  .mrep-apartment-table th .sort-icon {
    right: 0.26vw; /* 5px / 19.2 */
  }

  /* --- Style dla popupów (Formularz, Historia) --- */

  .mrep-modal-content {
    padding: 1.3vw; /* 25px / 19.2 */

    border-radius: 0.42vw; /* 8px / 19.2 */

    max-width: 31.25vw; /* 600px / 19.2 */
  }

  .mrep-close-btn {
    font-size: 1.56vw; /* 30px / 19.2 */
  }

  #mrep-popup-content h3 {
    border-bottom: 0.052vw solid #ccc; /* 1px / 19.2 */

    padding-bottom: 0.52vw; /* 10px / 19.2 */
  }

  /* --- Style dla panelu administracyjnego --- */

  #mrep-tabs-container {
    border: 0.052vw solid #ccc; /* 1px / 19.2 */

    padding: 1.04vw; /* 20px / 19.2 */
  }

  .mrep-tabs-list {
    border-bottom: 0.052vw solid #ccc; /* 1px / 19.2 */
  }

  .mrep-tabs-list li {
    padding: 0.52vw 0.78vw; /* 10px 15px / 19.2 */

    border: 0.052vw solid #ccc; /* 1px / 19.2 */

    border-radius: 0.26vw 0.26vw 0 0; /* 5px 5px 0 0 / 19.2 */

    margin-right: 0.26vw; /* 5px / 19.2 */
  }

  .mrep-tabs-list li .remove-tab {
    right: 0.26vw; /* 5px / 19.2 */

    top: 0.26vw; /* 5px / 19.2 */

    font-size: 0.83vw; /* 16px / 19.2 */
  }

  .mrep-tabs-list #add-new-tab-btn {
    border: 0.052vw solid #ccc; /* 1px / 19.2 */

    border-radius: 0.26vw; /* 5px / 19.2 */
  }
}
