/* Wykluczenie domyślnych stylów WordPressa dla nieparzystych wierszy */
.jcm-properties-table tbody tr:nth-child(odd) > td,
.jcm-properties-table tbody tr:nth-child(odd) > th {
    background-color: inherit !important;
}

/* Pozostawienie efektu hover */
.jcm-properties-table tbody tr:hover > td,
.jcm-properties-table tbody tr:hover > th {
    background-color: hsla(0, 0%, 50%, .102) !important;
}

/* Responsywna tabela frontend */
.jcm-properties-table-container {
    margin: 20px 0;
}

.jcm-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.jcm-table-search {
    margin-bottom: 15px;
}

.jcm-search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.jcm-table-responsive {
    min-width: 1100px;
}

.jcm-properties-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.jcm-properties-table th {
    background: #0073aa;
    color: white;
	vertical-align: middle;
    padding: 12px 15px;
    text-align: left;
    position: relative;
}

.jcm-properties-table th:hover {
    background: #005a87;
}

.jcm-properties-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
	vertical-align: middle;
}

.jcm-properties-table tr:hover {
    background: #f9f9f9;
}

.jcm-properties-table .button {
	display:inline-block;
	text-align:center;
    width: 100%;
}

.jcm-properties-table .button-small {
    padding: 5px 10px;
    font-size: 14px;
    min-height: auto;
}

/* Paginacja */
.jcm-table-pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
}

.jcm-table-pagination .page-number {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

.jcm-table-pagination .page-number.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Modale */
.price-history-table-container{
	margin-top:40px;
	overflow-y:auto;
}

.jcm-price-history-modal .modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.jcm-karta-lokalu-modal .modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
	max-width:none !important;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.jcm-price-history-modal .close-modal, .jcm-karta-lokalu-modal .close-modal {
    position: absolute;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: white;
    background-color: transparent !important;
    border: 0 !important;
}

.jcm-price-history-modal .close-modal:hover, .jcm-karta-lokalu-modal .close-modal:hover {
    transform:scale(1.25);
}

.price-history-content table {
    width: 100%;
    margin-top: 15px;
}

.price-history-content th {
    background: #f5f5f5;
    padding: 10px;
    text-align: left;
}

.price-history-content td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* Modal historii cen z najniższą ceną */
.jcm-price-history-modal, .jcm-karta-lokalu-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
	background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(3px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: #0073aa;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-price-history-modal  {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-price-history-modal:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
	overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: right;
}

/* Tabela historii cen */
.price-history-table {
	min-width:500px;
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.price-history-table th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.price-history-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #e9ecef;
}

.price-history-table tr:hover {
    background: #f8f9fa;
}

.price-history-table tr.current-price {
    background: #f1f8e9;
}

/* Spinner ładowania */
.loading-spinner {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsywność modala */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 70vh;
    }
    
    .price-history-table {
        font-size: 14px;
    }
    
    .price-history-table th,
    .price-history-table td {
        padding: 8px 10px;
    }
}

/* Blokada scrolla gdy modal jest otwarty */
body.modal-open {
    overflow: hidden;
}

/* Styl dla komórki z historią cen w tabeli */
.price-history-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.lowest-price-badge {
    transition: all 0.2s ease;
}

.lowest-price-badge:hover {
    transform: scale(1.05);
}

/* Animacja tooltipa */
.price-tooltip {
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Style dla sortowania */
.jcm-properties-table th.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.jcm-properties-table th.sortable:hover {
    background-color: rgba(0, 115, 170, 0.9) !important;
}

.jcm-properties-table th .sort-indicator {
	position:absolute;
	right:12px;
    display: inline-flex;
    flex-direction: column;
}

.jcm-properties-table th .sort-indicator .dashicons {
    font-size: 14px;
    height: 8px;
    width: 6px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.jcm-properties-table th .sort-indicator .dashicons.active {
    opacity: 1;
}

.jcm-properties-table th.sorted-asc .sort-indicator .dashicons-arrow-up {
    opacity: 1;
    color: #fff;
}

.jcm-properties-table th.sorted-desc .sort-indicator .dashicons-arrow-down {
    opacity: 1;
    color: #fff;
}

/* Styl dla aktywnego sortowania */
.jcm-properties-table th.sorted-asc,
.jcm-properties-table th.sorted-desc {
    background-color: rgba(0, 115, 170, 0.9) !important;
}

.jcm-properties-table th:hover {
    background-color: rgba(0, 115, 170, 0.8) !important;
}

/* Style dla kolumn niesortowalnych */
.jcm-properties-table th.non-sortable {
    cursor: default !important;
    user-select: auto;
}

.jcm-properties-table th.non-sortable:hover {
    background-color: inherit !important;
}

/* Dynamiczne style będą dodane przez JavaScript */