/* ==========================================================================
   SANATORIUMS SEARCH FORM WIDGET & SKELETON LOADER
   ========================================================================== */

.filters-section {
    position: relative !important;
    z-index: 100 !important;
    overflow: visible !important;
}

.filters-section .container {
    overflow: visible !important;
}

.sanatorium-search-container {
    margin-top: 24px;
    position: relative;
    z-index: 1000;
    overflow: visible;
}

.sanatorium-search-form {
    background: var(--surface-color, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    padding: 16px 20px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
    display: grid;
    grid-template-columns: 2.2fr 1.8fr 1.8fr auto;
    gap: 16px;
    align-items: center;
    position: relative;
    overflow: visible;
}

/* Individual Search Fields */
.search-field {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1.5px solid #f1f5f9;
    transition: all 0.25s ease;
}

.search-field:hover,
.search-field:focus-within {
    background: #ffffff;
    border-color: var(--accent-color, #c5a880);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Field Validation Error State */
.search-field.has-error {
    border-color: #ef4444 !important;
    background: #fff5f5 !important;
    animation: fieldShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes fieldShake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
    40%, 60% { transform: translate3d(3px, 0, 0); }
}

.search-field-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.search-field-label svg {
    stroke: var(--accent-color, #c5a880);
    flex-shrink: 0;
}

.search-field.has-error .search-field-label {
    color: #ef4444;
}

.search-field.has-error .search-field-label svg {
    stroke: #ef4444;
}

.search-field-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    outline: none;
    padding: 4px 0;
    cursor: text;
    font-family: inherit;
}

.search-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Dropdown Toggle Arrow */
.dropdown-arrow-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-left: 6px;
    flex-shrink: 0;
}

.dropdown-arrow-btn:hover {
    color: var(--accent-color, #c5a880);
    background: rgba(0, 0, 0, 0.05);
}

.dropdown-arrow-btn.is-active svg {
    transform: rotate(180deg);
}

.dropdown-arrow-btn svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* City Dropdown Menu (Grouped by Resorts) */
.city-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    min-width: 340px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    max-height: 420px;
    overflow-y: auto;
    z-index: 99999 !important;
    display: none;
    padding: 8px 0;
    animation: dropdownFadeIn 0.2s ease-out;
}

.city-dropdown-menu.is-open {
    display: block;
}

.city-group-header {
    padding: 10px 18px 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-color, #c5a880);
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 5;
    user-select: none;
}

.city-group-header:first-child {
    border-top: none;
    margin-top: 0;
}

.city-dropdown-item {
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}

.city-dropdown-item:hover {
    background: #f1f5f9;
    color: var(--accent-color, #c5a880);
}

.city-dropdown-item .city-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
}

.city-dropdown-empty {
    padding: 24px;
    text-align: center;
    font-size: 14px;
    color: #94a3b8;
}

/* Guests Button & Popover */
.guests-trigger-btn {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    padding: 4px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: inherit;
    user-select: none;
}

.guests-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    padding: 22px;
    z-index: 99999 !important;
    display: none;
    animation: dropdownFadeIn 0.2s ease-out;
}

.guests-popover.is-open {
    display: block;
}

.guest-counter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.guest-counter-info .guest-type-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.guest-counter-info .guest-type-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.counter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.counter-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    touch-action: manipulation;
}

.counter-btn:hover:not(:disabled) {
    background: var(--accent-color, #c5a880);
    border-color: var(--accent-color, #c5a880);
    color: #ffffff;
}

.counter-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.counter-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.counter-val {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    min-width: 24px;
    text-align: center;
}

/* Children Ages Container */
.children-ages-block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.children-ages-title {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.child-age-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.child-age-row span {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.child-age-select {
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.child-age-select:focus {
    border-color: var(--accent-color, #c5a880);
}

.guests-popover-done-btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.guests-popover-done-btn:hover {
    background: var(--accent-color, #c5a880);
    color: #ffffff;
}

/* Search Submit Button */
.search-submit-btn {
    background: var(--accent-color, #c5a880);
    color: #0f172a;
    border: none;
    border-radius: 14px;
    padding: 16px 28px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 6px 20px rgba(197, 168, 128, 0.3);
    white-space: nowrap;
    height: 100%;
    align-self: stretch;
    justify-content: center;
}

.search-submit-btn:hover {
    background: #b59567;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(197, 168, 128, 0.4);
}

.search-submit-btn:active {
    transform: translateY(0);
}

/* Flatpickr 2 Months Customization */
.flatpickr-calendar {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2) !important;
    border-radius: 16px !important;
    border: 1px solid #e2e8f0 !important;
    z-index: 99999 !important;
}

@media (min-width: 768px) {
    .flatpickr-calendar.hasMonths {
        width: 620px !important;
    }
}

/* ==========================================================================
   GRID SMOOTH TRANSITIONS & SKELETON PLACEHOLDER LOADER
   ========================================================================== */

#sanatoriums-grid {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
}

#sanatoriums-grid.is-loading {
    opacity: 0.35 !important;
    pointer-events: none !important;
    filter: blur(1px);
}

/* Skeleton Loading Grid */
.skeleton-grid-wrapper {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.skeleton-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

.skeleton-image {
    height: 220px;
    width: 100%;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.skeleton-line {
    border-radius: 6px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-line-sm {
    height: 12px;
    width: 40%;
}

.skeleton-line-title {
    height: 22px;
    width: 80%;
}

.skeleton-line-tags {
    display: flex;
    gap: 8px;
}

.skeleton-tag {
    height: 24px;
    width: 70px;
    border-radius: 12px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-bottom {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-price {
    height: 20px;
    width: 90px;
}

.skeleton-btn {
    height: 36px;
    width: 110px;
    border-radius: 10px;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Card Entry Animation */
.feature-card.fade-up {
    animation: cardFadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    .sanatorium-search-form {
        grid-template-columns: 1fr 1fr;
    }
    .search-submit-btn {
        grid-column: span 2;
        padding: 14px 20px;
    }
}

@media (max-width: 640px) {
    .sanatorium-search-form {
        grid-template-columns: 1fr;
        padding: 14px;
        border-radius: 16px;
    }
    .search-submit-btn {
        grid-column: span 1;
    }
    .city-dropdown-menu,
    .guests-popover {
        width: 100%;
        left: 0;
        right: 0;
    }
}
