/**
 * Company Search Field - Styly pro autocomplete
 */

/* Wrapper */
.csf-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

/* Label */
.csf-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
    color: #333;
}

.csf-label .required {
    color: #e74c3c;
}

/* Input wrapper */
.csf-input-wrapper {
    position: relative;
}

/* Input pole */
.csf-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.csf-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.csf-input::placeholder {
    color: #999;
}

/* Loading indicator */
.csf-loading {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.csf-spinner {
    width: 20px;
    height: 20px;
    animation: csf-rotate 2s linear infinite;
}

.csf-spinner .path {
    stroke: #3498db;
    stroke-linecap: round;
    animation: csf-dash 1.5s ease-in-out infinite;
}

@keyframes csf-rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes csf-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Dropdown */
.csf-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
   
    max-height: 300px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

/* Vybraná firma - zobrazení pod inputem */
.csf-selected-company {
    
    padding: 1rem;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.csf-selected-info {
    position: relative;
}

.csf-selected-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.csf-selected-header strong {
    color: #333;
    line-height: 1.4;
    flex: 1;
}

.csf-clear-selection {
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.csf-clear-selection:hover {
    background-color: #f17c1f;
    color: #272c35;
}

.csf-selected-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.csf-detail {
    color: #666;
    line-height: 1.5;
}

.csf-detail strong {
    color: #555;
    margin-right: 0.25rem;
}

/* Scrollbar styling */
.csf-dropdown::-webkit-scrollbar {
    width: 8px;
}

.csf-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.csf-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.csf-dropdown::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Dropdown položka */
.csf-dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
}

.csf-dropdown-item:last-child {
    border-bottom: none;
}

.csf-dropdown-item:hover,
.csf-dropdown-item.active {
    background-color: #f8f9fa;
}

.csf-dropdown-item-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.csf-dropdown-item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #666;
}

.csf-dropdown-item-details span {
    display: inline-block;
}

.csf-ico {
    font-weight: 500;
    color: #555;
}

.csf-address {
    color: #777;
}

/* Prázdný stav */
.csf-dropdown-empty {
    padding: 1rem;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Chybový stav */
.csf-dropdown-error {
    padding: 1rem;
    text-align: center;
    color: #e74c3c;
    background-color: #fef5f5;
}

/* Responsivita */
@media (max-width: 768px) {
    .csf-input {
        font-size: 16px; /* Zabrání zoomu na iOS */
    }
    
    .csf-dropdown {
        max-height: 250px;
    }
    
    .csf-dropdown-item {
        padding: 0.625rem 0.875rem;
    }
    
    .csf-dropdown-item-details {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Dark mode podpora (volitelné) */
@media (prefers-color-scheme: dark) {
    .csf-label {
        color: #e0e0e0;
    }
    
    .csf-input {
        color: #e0e0e0;
        background-color: #2c2c2c;
        border-color: #444;
    }
    
    .csf-input:focus {
        border-color: #3498db;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    }
    
    .csf-dropdown {
        background-color: #2c2c2c;
        border-color: #444;
    }
    
    .csf-dropdown-item {
        border-bottom-color: #3a3a3a;
    }
    
    .csf-dropdown-item:hover,
    .csf-dropdown-item.active {
        background-color: #363636;
    }
    
    .csf-dropdown-item-name {
        color: #e0e0e0;
    }
    
    .csf-dropdown-item-details {
        color: #b0b0b0;
    }
    
    .csf-ico {
        color: #c0c0c0;
    }
    
    .csf-address {
        color: #999;
    }
    
    .csf-dropdown-empty {
        color: #888;
    }
    
    .csf-dropdown-error {
        background-color: #3d2020;
    }
    
    /* Selected company dark mode */
    .csf-selected-company {
        background-color: #303641;
        border-color: #303641;
    }
    
    .csf-selected-header strong {
        color: #e0e0e0;
    }
    
    .csf-detail {
        color: #b0b0b0;
    }
    
    .csf-detail strong {
        color: #c0c0c0;
    }
}

/* Bricks Builder specifické úpravy */
.brx-body .csf-wrapper {
    margin-bottom: 1.5rem;
}

/* Animace pro zobrazení dropdownu */
@keyframes csf-dropdown-slide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.csf-dropdown {
    animation: csf-dropdown-slide 0.2s ease-out;
}
