/**
 * Style dla trybu iframe
 * Wysokospecyficzne selektory aby nadpisać style strony nadrzędnej
 */

/* Czcionka IBM Plex Sans dla całego iframe */
html body[data-iframe-mode="true"] {
    font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-weight: 400 !important;
}

html body[data-iframe-mode="true"] h1,
html body[data-iframe-mode="true"] h2,
html body[data-iframe-mode="true"] h3,
html body[data-iframe-mode="true"] h4,
html body[data-iframe-mode="true"] h5,
html body[data-iframe-mode="true"] h6 {
    font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-weight: 600 !important;
}

html body[data-iframe-mode="true"] button,
html body[data-iframe-mode="true"] input,
html body[data-iframe-mode="true"] select,
html body[data-iframe-mode="true"] textarea {
    font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* Reset CSS dla iframe */
html body[data-iframe-mode="true"] {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    overflow-x: hidden !important;
    /* Dziedzicz czcionki od rodzica */
    font-family: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    box-sizing: border-box !important;
    font-size: inherit !important;
    background-color: transparent !important;
}

html body[data-iframe-mode="true"] * {
    box-sizing: border-box !important;
}

/* Reset marginesów i paddingów */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}

/* Główny kontener */
html body[data-iframe-mode="true"] .advanced-post-filter {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Formularz wyszukiwania */
html body[data-iframe-mode="true"] #apf-filter-form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 15px !important;
    margin: 0 !important;
    background: transparent !important;
}

/* Układ formularza */
html body[data-iframe-mode="true"] .grid-2,
html body[data-iframe-mode="true"] .grid-3,
html body[data-iframe-mode="true"] .grid-bottom {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    margin: 0 0 15px 0 !important;
}

html body[data-iframe-mode="true"] .grid-2 > div {
    flex: 1 1 calc(50% - 15px) !important;
    min-width: 200px !important;
}

html body[data-iframe-mode="true"] .grid-3 > div {
    flex: 1 1 calc(33.333% - 15px) !important;
    min-width: 180px !important;
}

html body[data-iframe-mode="true"] .grid-bottom {
    justify-content: flex-end !important;
}

/* Pola formularza */
html body[data-iframe-mode="true"] input[type="text"],
html body[data-iframe-mode="true"] input[type="search"],
html body[data-iframe-mode="true"] select {
    width: 100% !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    font-size: 14px !important;
    height: 38px !important;
    appearance: auto !important;
}

html body[data-iframe-mode="true"] select:disabled {
    background-color: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed !important;
}

html body[data-iframe-mode="true"] label {
    display: block !important;
    margin-bottom: 5px !important;
    font-weight: 500 !important;
    color: inherit !important;
}

/* Przyciski */
html body[data-iframe-mode="true"] button,
html body[data-iframe-mode="true"] .uk-button {
    display: inline-block !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    font-size: 14px !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
}

html body[data-iframe-mode="true"] button[type="submit"],
html body[data-iframe-mode="true"] .uk-button-primary {
    background-color: #1e87f0 !important;
    color: #fff !important;
    border-color: #1e87f0 !important;
}

html body[data-iframe-mode="true"] button[type="reset"],
html body[data-iframe-mode="true"] .uk-button-default {
    background-color: #f8f8f8 !important;
    color: #666 !important;
}

/* Wyniki wyszukiwania */
html body[data-iframe-mode="true"] #apf-results {
    width: 100% !important;
    max-width: 100% !important;
    padding: 15px !important;
    margin: 0 !important;
}

html body[data-iframe-mode="true"] .apf-result-item {
    padding: 15px !important;
    margin-bottom: 15px !important;
    border: 1px solid #eee !important;
    border-radius: 4px !important;
    background-color: #fff !important;
}

html body[data-iframe-mode="true"] .apf-result-item h3 {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    font-size: 18px !important;
    color: inherit !important;
}

html body[data-iframe-mode="true"] .apf-result-item a {
    color: #1e87f0 !important;
    text-decoration: none !important;
    transition: color 0.2s !important;
}

html body[data-iframe-mode="true"] .apf-result-item a:hover {
    color: #0f6ecd !important;
    text-decoration: underline !important;
}

/* Paginacja */
html body[data-iframe-mode="true"] .apf-pagination-container {
    margin-top: 20px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
}

html body[data-iframe-mode="true"] .apf-pagination {
    display: inline-block !important;
    padding: 5px 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background-color: #f8f8f8 !important;
    color: #333 !important;
    text-decoration: none !important;
    cursor: pointer !important;
}

html body[data-iframe-mode="true"] .apf-pagination.current {
    background-color: #1e87f0 !important;
    color: #fff !important;
    border-color: #1e87f0 !important;
}

/* Alerty */
html body[data-iframe-mode="true"] .uk-alert {
    padding: 15px !important;
    margin-bottom: 15px !important;
    border-radius: 4px !important;
    position: relative !important;
}

html body[data-iframe-mode="true"] .uk-alert-primary {
    background-color: #d8eafc !important;
    color: #1e87f0 !important;
}

html body[data-iframe-mode="true"] .uk-alert-success {
    background-color: #edfbf6 !important;
    color: #32d296 !important;
}

html body[data-iframe-mode="true"] .uk-alert-warning {
    background-color: #fff6ee !important;
    color: #faa05a !important;
}

html body[data-iframe-mode="true"] .uk-alert-danger {
    background-color: #fef4f6 !important;
    color: #f0506e !important;
}

/* Responsywność */
@media (max-width: 768px) {
    html body[data-iframe-mode="true"] .grid-2 > div,
    html body[data-iframe-mode="true"] .grid-3 > div {
        flex: 1 1 100% !important;
    }
    
    html body[data-iframe-mode="true"] .grid-bottom {
        justify-content: center !important;
    }
    
    html body[data-iframe-mode="true"] button,
    html body[data-iframe-mode="true"] .uk-button {
        display: block !important;
        width: 100% !important;
        margin-bottom: 10px !important;
    }
}

/* Animacja ładowania */
@keyframes apf-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

html body[data-iframe-mode="true"] .apf-loading {
    animation: apf-pulse 1.5s infinite ease-in-out !important;
}

/* Usunięcie przewijania wewnątrz iframe */
html body[data-iframe-mode="true"] * {
    max-width: 100% !important;
    word-wrap: break-word !important;
}