/* Dynamic feed toolbar + location UX */

.vcardi-feed-dynamic > .vcardi-feed-title:empty {
    display: none;
}

/* Full-bleed fixed filters docked under Cartfa header */
.vcardi-dynamic-filters-spacer {
    display: block;
    width: 100%;
    height: 0;
    margin: 0 0 16px;
    pointer-events: none;
}

.vcardi-dynamic-filters-wrap {
    position: relative;
    z-index: 40;
    margin: 0 0 16px;
    padding: 8px 12px 10px;
    background: var(--vcardi-dyn-bar-bg, rgba(255, 255, 255, 0.96));
    color: var(--vcardi-dyn-bar-color, #374151);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--vcardi-dyn-bar-radius, 18px);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-sizing: border-box;
}

.vcardi-dynamic-filters-wrap.is-fixed,
.vcardi-dynamic-filters-wrap.is-sticky {
    position: fixed;
    top: var(--cartfa-header-h, 56px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    z-index: 99998; /* just under .cartfa-header (~99999) */
    padding-inline: max(12px, calc((100% - min(100%, var(--cartfa-max, 1200px))) / 2 + 8px));
    /* Match header hide animation so they stay glued */
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.vcardi-dynamic-filters-wrap.is-fixed.is-header-hidden,
.vcardi-dynamic-filters-wrap.is-sticky.is-header-hidden {
    /* Same pixel travel as .cartfa-header.is-hidden { transform: translateY(-110%) } */
    transform: translateY(calc(-1.1 * var(--cartfa-header-h, 56px)));
}

body.admin-bar .vcardi-dynamic-filters-wrap.is-fixed,
body.admin-bar .vcardi-dynamic-filters-wrap.is-sticky {
    top: var(--cartfa-header-h, 56px);
}

.vcardi-dynamic-filters-wrap.has-shadow {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.vcardi-dynamic-toolbar {
    position: relative;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.vcardi-dynamic-toolbar-track {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
}

.vcardi-dynamic-toolbar-track::-webkit-scrollbar {
    display: none;
}

.vcardi-dynamic-tool {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.vcardi-dynamic-tool:hover {
    transform: translateY(-1px);
    background: rgba(148, 163, 184, 0.12);
}

.vcardi-dynamic-tool:active {
    transform: scale(0.96);
}

.vcardi-dynamic-tool-icon {
    font-size: var(--vcardi-dyn-icon-size, 18px);
    line-height: 1;
    display: inline-flex;
}

.vcardi-dynamic-tool-label {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.vcardi-dynamic-tool-ripple {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(circle at center, color-mix(in srgb, var(--tool-color) 35%, transparent) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.vcardi-dynamic-tool.is-activating .vcardi-dynamic-tool-ripple {
    opacity: 1;
    transform: scale(1.15);
}

.vcardi-dynamic-toolbar.active-style-fill .vcardi-dynamic-tool.is-active {
    background: var(--tool-color);
    color: #fff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--tool-color) 35%, transparent);
}

.vcardi-dynamic-toolbar.active-style-glow .vcardi-dynamic-tool.is-active {
    color: var(--tool-color);
    border-color: color-mix(in srgb, var(--tool-color) 45%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tool-color) 18%, transparent), 0 8px 20px color-mix(in srgb, var(--tool-color) 25%, transparent);
}

.vcardi-dynamic-toolbar.active-style-underline .vcardi-dynamic-tool.is-active {
    color: var(--tool-color);
    box-shadow: inset 0 -3px 0 var(--tool-color);
    border-radius: 12px;
}

.vcardi-dynamic-tool.is-reverse-tool.is-active {
    transform: rotate(180deg);
}

.vcardi-dynamic-toolbar-status {
    margin-top: 6px;
    min-height: 0;
    font-size: 12px;
    color: #64748b;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.vcardi-dynamic-toolbar-status.is-visible {
    opacity: 1;
}

.vcardi-dynamic-category-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.vcardi-dynamic-category-group {
    flex: 1 1 120px;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.vcardi-dynamic-category-group label {
    display: none;
}

.vcardi-dynamic-category-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 9px 34px 9px 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E") no-repeat left 10px center;
    background-size: 12px;
    color: #1e293b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vcardi-dynamic-category-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
}

.vcardi-dynamic-category-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background-color: #f1f5f9;
}

.vcardi-dynamic-category-clear {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    padding: 0;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.vcardi-dynamic-category-clear:hover {
    background: #fecaca;
    transform: translateY(-1px);
}

.vcardi-feed-dynamic.is-refreshing .vcardi-feed-grid {
    opacity: 0.45;
    filter: saturate(0.85);
    pointer-events: none;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.vcardi-feed-dynamic .vcardi-feed-grid {
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.vcardi-feed-dynamic .vcardi-feed-card.vcardi-dyn-enter {
    animation: vcardiDynCardIn 0.35s ease both;
}

@keyframes vcardiDynCardIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.vcardi-dynamic-location-panel {
    margin: 10px 0 24px;
    padding: 28px 20px;
    border-radius: 18px;
    background: linear-gradient(160deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    text-align: center;
}

.vcardi-dynamic-location-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #2563eb;
    font-size: 28px;
}

.vcardi-dynamic-location-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #1e3a8a;
}

.vcardi-dynamic-location-text,
.vcardi-dynamic-location-status {
    margin: 0 0 12px;
    color: #475569;
    font-size: 14px;
}

.vcardi-dynamic-location-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.vcardi-dynamic-gps-btn,
.vcardi-dynamic-map-btn,
.vcardi-dynamic-location-confirm,
.vcardi-dynamic-location-cancel {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vcardi-dynamic-gps-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.vcardi-dynamic-map-btn,
.vcardi-dynamic-location-confirm {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.vcardi-dynamic-location-cancel {
    background: #64748b;
}

.vcardi-dynamic-gps-btn:hover,
.vcardi-dynamic-map-btn:hover,
.vcardi-dynamic-location-confirm:hover,
.vcardi-dynamic-location-cancel:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.vcardi-dynamic-location-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    padding: 16px;
}

.vcardi-dynamic-location-modal.is-open {
    display: flex;
}

.vcardi-dynamic-location-modal-content {
    width: min(860px, 100%);
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.vcardi-dynamic-location-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.vcardi-dynamic-location-modal-header h3 {
    margin: 0;
    font-size: 17px;
    color: #1f2937;
}

.vcardi-dynamic-location-modal-close {
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

.vcardi-dynamic-location-modal-hint {
    margin: 0 0 10px;
    color: #64748b;
    font-size: 13px;
}

.vcardi-dynamic-location-map {
    width: 100%;
    height: min(55vh, 420px);
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.vcardi-dynamic-location-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 12px;
}

@media (max-width: 640px) {
    .vcardi-dynamic-filters-wrap.is-fixed,
    .vcardi-dynamic-filters-wrap.is-sticky {
        padding-inline: 10px;
    }

    .vcardi-dynamic-tool {
        min-width: 42px;
        min-height: 42px;
        padding: 9px 12px;
    }

    .vcardi-dynamic-tool-label {
        display: none;
    }

    .vcardi-dynamic-category-bar {
        gap: 6px;
    }

    .vcardi-dynamic-category-group {
        flex: 1 1 calc(50% - 6px);
        min-width: calc(50% - 6px);
    }

    .vcardi-dynamic-location-modal-content {
        padding: 12px;
    }

    .vcardi-dynamic-location-map {
        height: 48vh;
    }
}
