/**
 * KRDB Search Overlay Widget Styles
 * 
 * Style dla widgetu wyszukiwarki overlay
 * 
 * @package KRDB_Core
 * @since 1.0.0
 */

/* Przycisk wywołujący */
.krdb-search-trigger-wrapper {
    display: inline-block;
}

.krdb-search-trigger {
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
    color: #333333;
    font-size: 16px;
    /* Domyślne rozmiary - będą nadpisane przez Elementor */
    width: 40px;
    height: 40px;
}

.krdb-search-trigger i {
    line-height: 1;
    display: inline-block;
    /* Domyślny rozmiar ikony - będzie nadpisany przez Elementor */
    font-size: 18px;
    /* Dziedziczenie koloru z przycisku */
    color: inherit;
}

.krdb-search-trigger svg {
    line-height: 1;
    display: inline-block;
    /* Domyślny rozmiar SVG - będzie nadpisany przez Elementor */
    width: 18px;
    height: 18px;
    /* Dziedziczenie koloru z przycisku */
    fill: currentColor;
    color: inherit;
}

.krdb-search-trigger svg path {
    fill: currentColor;
    stroke: currentColor;
}

/* Dodatkowe selektory dla ikon Elementor */
.krdb-search-trigger .elementor-icon {
    color: inherit;
}

.krdb-search-trigger .elementor-icon i {
    color: inherit;
}

.krdb-search-trigger .elementor-icon svg {
    fill: currentColor;
    color: inherit;
}

.krdb-search-trigger .elementor-icon svg path {
    fill: currentColor;
    stroke: currentColor;
}

.krdb-search-trigger:focus {
    outline: none;
    box-shadow: none;
}

.krdb-search-trigger:active {
    outline: none;
    box-shadow: none;
}

.krdb-search-trigger:focus-visible {
    outline: none;
    box-shadow: none;
}

.krdb-search-trigger .trigger-text {
    font-size: inherit;
    line-height: 1;
}

/* Overlay główny */
.krdb-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6L18 18"/></svg>'), auto;
}

.krdb-search-overlay.blur-enabled {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.krdb-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Zawartość overlay */
.search-overlay-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    cursor: default;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* Pole wyszukiwania */
.search-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    gap: 10px;
}

.search-input-container:focus-within {
    border-color: #0073aa;
}

.search-input {
    flex: 1;
    border: none;
    background-color: transparent;
    outline: none;
    box-shadow: none;
    border-radius: 0;
}

.search-input:focus {
    box-shadow: none;
    transform: none;
    outline: none;
    border: none;
    background-color: transparent;
}

.search-input:focus-visible {
    outline: none;
    box-shadow: none;
}

.search-input:active {
    outline: none;
    box-shadow: none;
    border: none;
}

.search-input::placeholder {
    color: #999999;
    opacity: 1;
}

/* Usunięcie wszystkich domyślnych stylów input */
.search-input,
.search-input:focus,
.search-input:active,
.search-input:focus-visible,
.search-input:focus-within {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none;
    background-clip: padding-box;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-radius: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Usunięcie outline w różnych przeglądarkach */
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Ikonka wyszukiwania wewnątrz kontenera */
.search-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: #0073aa;
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    text-decoration: none;
    outline: none;
    box-shadow: none;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin: 5px;
    border-radius: 8px;
}

.search-icon-button:hover {
    background-color: #005a87;
    color: #ffffff;
    text-decoration: none;
}

.search-icon-button:focus,
.search-icon-button:active {
    outline: none;
    box-shadow: none;
}

.search-icon-button i,
.search-icon-button svg {
    color: inherit;
    fill: currentColor;
    stroke: currentColor;
}

.search-icon-button svg {
    width: 18px;
    height: 18px;
}

.search-icon-button svg path {
    fill: currentColor;
    stroke: currentColor;
}

.search-icon-text {
    margin-left: 8px;
    font-weight: 500;
}

/* Przyciski filtrowania */
.search-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

/* Wyrównania przycisków filtrowania */
.search-filters.align-left {
    justify-content: flex-start;
}

.search-filters.align-center {
    justify-content: center;
}

.search-filters.align-right {
    justify-content: flex-end;
}

.search-filters.align-justify {
    justify-content: space-between;
}

.search-filters.align-justify .filter-button {
    flex: 1;
    text-align: center;
}

.filter-button {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #666666;
    outline: none;
    position: relative;
    overflow: hidden;
}

/* Stan hover - będzie nadpisany przez Elementor */
.filter-button:hover {
    background-color: #f5f5f5;
    border-color: #0073aa;
    color: #0073aa;
}

/* Stan aktywny - będzie nadpisany przez Elementor */
.filter-button.active {
    background-color: #f0f8ff;
    border-color: #0073aa;
    color: #0073aa;
}


/* Responsywność */
@media (max-width: 768px) {
    .search-overlay-content {
        width: 95%;
        padding: 0 10px;
    }
    
    .search-input {
        font-size: 16px;
        padding: 15px 20px;
    }
    
    
}

@media (max-width: 480px) {
    .search-overlay-content {
        width: 98%;
    }
    
    .search-input {
        font-size: 16px;
        padding: 12px 15px;
    }
    
}

/* Animacje wejścia i wyjścia */
.krdb-search-overlay.entering {
    animation: overlayFadeIn 0.3s ease;
}

.krdb-search-overlay.leaving {
    animation: overlayFadeOut 0.3s ease;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes overlayFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Style dla edytora Elementor */
.elementor-widget-krdb-search-overlay .krdb-search-trigger-wrapper {
    display: inline-block !important;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    /* Domyślne rozmiary - będą nadpisane przez ustawienia widgetu */
    width: 40px;
    height: 40px;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger i {
    line-height: 1;
    display: inline-block;
    /* Domyślny rozmiar ikony - będzie nadpisany przez ustawienia widgetu */
    font-size: 18px;
    /* Dziedziczenie koloru z przycisku */
    color: inherit;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger svg {
    line-height: 1;
    display: inline-block;
    /* Domyślny rozmiar SVG - będzie nadpisany przez ustawienia widgetu */
    width: 18px;
    height: 18px;
    /* Dziedziczenie koloru z przycisku */
    fill: currentColor;
    color: inherit;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger svg path {
    fill: currentColor;
    stroke: currentColor;
}

/* Dodatkowe selektory dla ikon Elementor w edytorze */
.elementor-widget-krdb-search-overlay .krdb-search-trigger .elementor-icon {
    color: inherit;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger .elementor-icon i {
    color: inherit;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger .elementor-icon svg {
    fill: currentColor;
    color: inherit;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger .elementor-icon svg path {
    fill: currentColor;
    stroke: currentColor;
}

.elementor-widget-krdb-search-overlay .krdb-search-trigger:hover {
    background: #e0e0e0;
    border-color: #0073aa;
}

/* Dostępność */
@media (prefers-reduced-motion: reduce) {
    .krdb-search-overlay,
    .search-overlay-content,
    .search-input,
    .result-item,
    .search-close {
        transition: none;
        animation: none;
    }
}

/* Tryb ciemny */
@media (prefers-color-scheme: dark) {
    .search-input-container {
        background-color: #2d2d2d;
        color: #ffffff;
        border-color: #404040;
    }
    
    .search-input {
        background-color: transparent;
        color: #ffffff;
    }
    
    .search-input::placeholder {
        color: #aaaaaa;
    }
    
    .search-results {
        background-color: #2d2d2d;
    }
    
    .result-item {
        border-bottom-color: #404040;
    }
    
    .result-item:hover {
        background-color: #3d3d3d;
    }
    
    .result-item-title {
        color: #ffffff;
    }
    
    .result-item-excerpt {
        color: #cccccc;
    }
}