/**
 * Location Autocomplete Styles
 * Design inspirovaný sreality.cz
 */

/* Container */
#lokalita-container {
    position: relative;
    width: 100%;
}

/* Input field */
#lokalita-search {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

#lokalita-search:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
}

/* Dropdown container */
.location-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 380px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.location-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Scrollbar styling */
.location-dropdown::-webkit-scrollbar {
    width: 6px;
}

.location-dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.location-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.location-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Location item */
.location-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

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

.location-item:hover,
.location-item.active {
    background-color: #f8fafc;
}

.location-item.active {
    background-color: #f1f5f9;
}

/* Item icon */
.location-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 8px;
    margin-right: 12px;
    color: #64748b;
    transition: all 0.15s ease;
}

.location-item:hover .location-item-icon,
.location-item.active .location-item-icon {
    background: #e0e7ff;
    color: #6366f1;
}

.location-item-icon svg {
    width: 18px;
    height: 18px;
}

/* Item content */
.location-item-content {
    flex: 1;
    min-width: 0;
}

.location-item-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-item-name mark {
    background: #fef08a;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* Count badge for municipalities */
.location-item-count {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

.location-item:hover .location-item-count,
.location-item.active .location-item-count {
    background: #e0e7ff;
    color: #4f46e5;
}

.location-item-type {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: 2px;
}

/* Loading state */
.location-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    color: #64748b;
    font-size: 0.875rem;
}

.location-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    margin-right: 10px;
    animation: location-spin 0.8s linear infinite;
}

@keyframes location-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state */
.location-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    color: #94a3b8;
    font-size: 0.875rem;
}

.location-empty-icon {
    margin-right: 8px;
    opacity: 0.7;
}

/* Error state */
.location-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    color: #ef4444;
    font-size: 0.875rem;
}

/* Type-specific styling for centrum (main cities) */
.location-item[data-type="centrum"] .location-item-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.location-item[data-type="centrum"]:hover .location-item-icon {
    background: #bfdbfe;
    color: #2563eb;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .location-dropdown {
        max-height: 300px;
        border-radius: 0 0 0.375rem 0.375rem;
    }

    .location-item {
        padding: 10px 14px;
    }

    .location-item-icon {
        width: 32px;
        height: 32px;
        margin-right: 10px;
    }

    .location-item-icon svg {
        width: 16px;
        height: 16px;
    }

    .location-item-name {
        font-size: 0.875rem;
    }

    .location-item-type {
        font-size: 0.75rem;
    }
}

/* Dark mode support */
[data-bs-theme="dark"] .location-dropdown,
.dark-mode .location-dropdown {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .location-item,
.dark-mode .location-item {
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .location-item:hover,
[data-bs-theme="dark"] .location-item.active,
.dark-mode .location-item:hover,
.dark-mode .location-item.active {
    background-color: #334155;
}

[data-bs-theme="dark"] .location-item-icon,
.dark-mode .location-item-icon {
    background: #334155;
    color: #94a3b8;
}

[data-bs-theme="dark"] .location-item:hover .location-item-icon,
[data-bs-theme="dark"] .location-item.active .location-item-icon,
.dark-mode .location-item:hover .location-item-icon,
.dark-mode .location-item.active .location-item-icon {
    background: #4f46e5;
    color: #ffffff;
}

[data-bs-theme="dark"] .location-item-name,
.dark-mode .location-item-name {
    color: #f1f5f9;
}

[data-bs-theme="dark"] .location-item-name mark,
.dark-mode .location-item-name mark {
    background: #854d0e;
    color: #fef08a;
}

[data-bs-theme="dark"] .location-item-type,
.dark-mode .location-item-type {
    color: #94a3b8;
}

[data-bs-theme="dark"] .location-loading,
[data-bs-theme="dark"] .location-empty,
.dark-mode .location-loading,
.dark-mode .location-empty {
    color: #94a3b8;
}

[data-bs-theme="dark"] .location-loading-spinner,
.dark-mode .location-loading-spinner {
    border-color: #475569;
    border-top-color: #818cf8;
}

[data-bs-theme="dark"] .location-dropdown::-webkit-scrollbar-track,
.dark-mode .location-dropdown::-webkit-scrollbar-track {
    background: #1e293b;
}

[data-bs-theme="dark"] .location-dropdown::-webkit-scrollbar-thumb,
.dark-mode .location-dropdown::-webkit-scrollbar-thumb {
    background: #475569;
}

[data-bs-theme="dark"] #lokalita-search,
.dark-mode #lokalita-search {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
}

/* Animation for dropdown appearance */
@keyframes location-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.location-dropdown.open .location-item {
    animation: location-fadeIn 0.2s ease forwards;
}

.location-dropdown.open .location-item:nth-child(1) { animation-delay: 0ms; }
.location-dropdown.open .location-item:nth-child(2) { animation-delay: 20ms; }
.location-dropdown.open .location-item:nth-child(3) { animation-delay: 40ms; }
.location-dropdown.open .location-item:nth-child(4) { animation-delay: 60ms; }
.location-dropdown.open .location-item:nth-child(5) { animation-delay: 80ms; }
.location-dropdown.open .location-item:nth-child(6) { animation-delay: 100ms; }
.location-dropdown.open .location-item:nth-child(7) { animation-delay: 120ms; }
.location-dropdown.open .location-item:nth-child(8) { animation-delay: 140ms; }
.location-dropdown.open .location-item:nth-child(9) { animation-delay: 160ms; }
.location-dropdown.open .location-item:nth-child(10) { animation-delay: 180ms; }
.location-dropdown.open .location-item:nth-child(11) { animation-delay: 200ms; }
.location-dropdown.open .location-item:nth-child(12) { animation-delay: 220ms; }
