/* Publikatorcen Units Widget Styles */

.puw-units-container {
    margin: 20px 0;
    font-family: var(--puw-font-family, inherit);
}

.puw-controls {
    margin-bottom: 20px;
    text-align: right;
}

.puw-refresh-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: var(--puw-font-size-body, 14px);
    transition: background-color 0.3s ease;
}

.puw-refresh-btn:hover {
    background: #005a87;
}

.puw-refresh-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.puw-refresh-icon {
    margin-right: 5px;
}

/* Grid Layout */
.puw-units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.puw-unit-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.puw-unit-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.puw-unit-number {
    font-size: var(--puw-font-size-xl, 18px);
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 8px;
}

.puw-investment {
    font-size: var(--puw-font-size-large, 16px);
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.puw-developer {
    font-size: var(--puw-font-size-body, 14px);
    color: #666;
    margin-bottom: 12px;
}

.puw-area {
    font-size: var(--puw-font-size-body, 14px);
    color: #555;
    margin-bottom: 12px;
}

.puw-prices {
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.puw-price-per-sqm {
    font-size: var(--puw-font-size-large, 16px);
    color: #0073aa;
    font-weight: bold;
    margin-bottom: 4px;
}

.puw-total-price {
    font-size: var(--puw-font-size-xl, 18px);
    color: #2c5530;
    font-weight: bold;
}

/* List Layout */
.puw-units-list {
    margin-top: 20px;
}

.puw-unit-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.puw-unit-info {
    flex: 1;
}

.puw-unit-header {
    margin-bottom: 8px;
}

.puw-unit-number {
    font-size: var(--puw-font-size-xl, 18px);
    font-weight: bold;
    color: #0073aa;
}

.puw-investment {
    color: #333;
    font-weight: 500;
}

.puw-developer {
    font-size: var(--puw-font-size-body, 14px);
    color: #666;
    margin-bottom: 4px;
}

.puw-area {
    font-size: var(--puw-font-size-body, 14px);
    color: #555;
}

.puw-prices {
    text-align: right;
    min-width: 150px;
}

.puw-price-per-sqm {
    font-size: var(--puw-font-size-large, 16px);
    color: #0073aa;
    font-weight: bold;
    margin-bottom: 4px;
}

.puw-total-price {
    font-size: var(--puw-font-size-xl, 18px);
    color: #2c5530;
    font-weight: bold;
}

/* Table Layout */
.puw-units-table-container {
    margin-top: 20px;
    overflow-x: auto;
}

.puw-units-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}

.puw-units-table th {
    color: #40392f;
    padding: 18px 16px 14px;
    text-align: left;
    font-weight: 600;
    font-size: var(--puw-font-size-body, 14px);
    background: transparent !important;
    border-bottom: 1px solid rgba(90, 78, 63, 0.45);
    white-space: nowrap;
}

.puw-units-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(90, 78, 63, 0.35);
    color: #4f473d;
    font-size: var(--puw-font-size-body, 14px);
    vertical-align: middle;
}

.puw-units-table tr:hover {
    background: rgba(255, 255, 255, 0.18);
}

.puw-client-table-wrap {
    background: transparent;
    padding-top: 6px;
}

.puw-client-table .puw-col-karta_lokalu {
    width: 140px;
}

.puw-client-table .puw-col-szczegoly,
.puw-client-table .puw-col-opis,
.puw-client-table .puw-col-uwagi {
    width: 170px;
    text-align: right;
}

/* Unified table - Units and Price History together */
.puw-unified-table .puw-unit-row {
    background: transparent;
    font-weight: 400;
}

.puw-unified-table .puw-unit-row:hover {
    background: rgba(255, 255, 255, 0.18);
}

.puw-unified-table .puw-ph-row {
    background: #fafafa;
    font-size: 0.95em;
}

.puw-unified-table .puw-ph-row:hover {
    background: #f0f0f0;
}

.puw-unified-table .puw-ph-cell {
    color: #555;
    font-style: italic;
}

.puw-unified-table .puw-unit-ref {
    color: #70665a;
    font-size: 0.95em;
}

.puw-unified-table .puw-ph-empty {
    background: #fafafa;
}

/* Status badges */
.puw-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: var(--puw-font-size-small, 12px);
    font-weight: 600;
    letter-spacing: .2px;
}
.puw-status-wolne {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.puw-status-rezerwacja {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}
.puw-status-sprzedane {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.puw-status-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4f473d;
    white-space: nowrap;
}

.puw-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #928679;
    flex: 0 0 8px;
}

.puw-status-inline-wolne .puw-status-dot {
    background: #4baa45;
}

.puw-status-inline-rezerwacja .puw-status-dot {
    background: #efb021;
}

.puw-status-inline-sprzedane .puw-status-dot {
    background: #d55442;
}

.puw-empty-value {
    color: #8f8578;
}

 

/* Error and No Units Messages */
.puw-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
}

.puw-no-units {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    margin: 20px 0;
    text-align: center;
}

/* Loading State */
.puw-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.puw-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: puw-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes puw-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .puw-units-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .puw-unit-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .puw-prices {
        text-align: left;
        margin-top: 10px;
        min-width: auto;
    }
    
    .puw-units-table-container {
        font-size: 14px;
    }
    
    .puw-units-table th,
    .puw-units-table td {
        padding: 8px;
    }

    /* Keep thumbnails in table large but slightly smaller on tablets */
    .puw-client-table .puw-product-card-thumb,
    .puw-client-table .puw-product-card-thumb--pdf {
        width: 90px;
        height: 90px;
        min-width: 90px;
        min-height: 90px;
    }
    .puw-client-table .puw-product-card-thumb--pdf .puw-pdf-icon svg {
        width: 30px;
        height: 30px;
    }

    .puw-details-button,
    .puw-product-card-button {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .puw-unit-card {
        padding: 15px;
    }
    
    .puw-unit-item {
        padding: 15px;
    }
    
    .puw-units-table {
        font-size: 12px;
    }
    
    .puw-units-table th,
    .puw-units-table td {
        padding: 6px;
    }

    /* On very small screens keep table thumbnails readable but a bit smaller */
    .puw-client-table .puw-product-card-thumb,
    .puw-client-table .puw-product-card-thumb--pdf {
        width: 80px;
        height: 80px;
        min-width: 80px;
        min-height: 80px;
    }
    .puw-client-table .puw-product-card-thumb--pdf .puw-pdf-icon svg {
        width: 26px;
        height: 26px;
    }
}

/* Product Card Icon in Table */
.puw-product-card-cell {
    text-align: left;
}

.puw-product-card-link {
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.puw-product-card-link:hover {
    transform: translateY(-1px);
}

.puw-product-card-button,
.puw-details-button {
    display: inline-block;
    padding: 10px 16px;
    background: #0a6b2d;
    color: #fff;
    border: 1px solid #0a6b2d;
    border-radius: 4px;
    text-decoration: none;
    font-family: inherit;
    font-size: var(--puw-font-size-button, 13px);
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.puw-product-card-button:hover,
.puw-details-button:hover {
    background: #085a23;
    color: #fff;
    border-color: #085a23;
    text-decoration: none;
}

.puw-product-card-button:active {
    background: #06471c;
    border-color: #06471c;
}

.puw-product-card-thumb {
    width: 68px;
    height: 68px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #d5cec4;
    padding: 6px;
    box-sizing: border-box;
}

/* Larger thumbnails specifically inside the table layout */
.puw-client-table .puw-product-card-thumb,
.puw-client-table .puw-product-card-thumb--pdf {
    width: 110px;
    height: 110px;
    min-width: 110px;
    min-height: 110px;
}

.puw-rzut-link:hover .puw-product-card-thumb {
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

/* PDF tile (same size as image thumb, icon inside) */
.puw-product-card-thumb--pdf {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    min-width: 68px;
    min-height: 68px;
    background: #fff;
    border: 1px solid #d5cec4;
    padding: 6px;
    box-sizing: border-box;
    color: #8b7355;
}
.puw-product-card-thumb--pdf .puw-pdf-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
}
.puw-product-card-thumb--pdf .puw-pdf-icon svg {
    width: 28px;
    height: 28px;
}
.puw-product-card-thumb--pdf .puw-pdf-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.puw-rzut-link:hover .puw-product-card-thumb--pdf {
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

/* Modal Styles */
.puw-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.puw-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.puw-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
}

.puw-modal-body {
    position: relative;
}

.puw-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    display: block;
    border-radius: 4px;
}

.puw-modal-content iframe {
    width: 100%;
    height: 80vh;
    border: none;
    border-radius: 4px;
}

.puw-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 10001;
    background: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.puw-modal-close:hover {
    color: #0073aa;
    background: #f0f0f0;
}

/* Responsive modal */
@media (max-width: 768px) {
    .puw-modal-content {
        max-width: 95%;
        padding: 15px;
    }
    
    .puw-modal-close {
        top: 5px;
        right: 10px;
        font-size: 24px;
        width: 28px;
        height: 28px;
    }
    
    .puw-modal-content img,
    .puw-modal-content iframe {
        max-height: 70vh;
    }
}
