/* ==========================================
   BOTTOM NAV - ESTILOS COMPLETOS
   SearchModal, UserProfile, ProductFeed
   ========================================== */

/* ---- SEARCH MODAL ---- */
#searchModal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    flex-direction: column;
}

#searchModal.active {
    display: flex;
}

.search-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.search-modal-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000000;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
    overflow: hidden;
}

#searchModal.active .search-modal-panel {
    transform: translateY(0);
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 60px 16px 16px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 12px 40px 12px 42px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.search-input-wrap input:focus {
    border-color: #f97316;
    background: rgba(249,115,22,0.08);
}

.search-input-wrap input::placeholder {
    color: rgba(255,255,255,0.3);
}

.search-input-icon {
    position: absolute;
    left: 14px;
    color: rgba(255,255,255,0.4);
    font-size: 14px;
    pointer-events: none;
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 10px;
}

.search-cancel-btn {
    background: none;
    border: none;
    color: #f97316;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    padding: 4px;
    font-family: inherit;
}

.search-section {
    padding: 20px 16px 8px;
}

.search-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.45);
    margin-bottom: 12px;
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-tag {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 7px 14px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.search-tag:hover, .search-tag:active {
    background: rgba(249,115,22,0.15);
    border-color: rgba(249,115,22,0.35);
    color: white;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 120px;
}

.search-products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.search-product-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.search-product-card:active {
    transform: scale(0.97);
}

.search-product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.search-product-info {
    padding: 8px 10px;
}

.search-product-name {
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-product-store {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 4px;
}

.search-product-price {
    font-size: 13px;
    font-weight: 700;
    color: #f97316;
}

.search-product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
}

.search-stores-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-store-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.search-store-item:active {
    background: rgba(249,115,22,0.1);
}

.search-store-item img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
}

.search-store-item > div { flex: 1; }

.search-store-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.search-store-info {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
}

.search-store-item > i {
    color: rgba(255,255,255,0.25);
    font-size: 13px;
}

.search-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: rgba(255,255,255,0.3);
    gap: 8px;
}

.search-empty i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 8px;
}

.search-empty p {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
}

.search-empty span {
    font-size: 13px;
}

/* ---- PROFILE MODAL ---- */
#profileModal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: flex-end;
}

#profileModal.active {
    display: flex;
}

.profile-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
}

.profile-panel {
    position: relative;
    width: 100%;
    max-height: 92vh;
    background: linear-gradient(180deg, #111111 0%, #000000 100%);
    border-radius: 28px 28px 0 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.1, 0.64, 1);
    padding-bottom: max(32px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

#profileModal.active .profile-panel {
    transform: translateY(0);
}

.profile-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 12px auto 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    object-fit: cover;
}

.profile-avatar-ring {
    position: absolute;
    inset: -3px;
    border-radius: 25px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    z-index: -1;
}

.profile-user-info h2 {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin-bottom: 3px;
}

.profile-user-info > p {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 8px;
}

.profile-badges {
    display: flex;
    gap: 6px;
}

.profile-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 8px;
}

.profile-badge.admin {
    background: rgba(249,115,22,0.15);
    color: #fb923c;
}

.profile-badge.owner {
    background: rgba(249,115,22,0.2);
    color: #fb923c;
}

.profile-badge.user {
    background: rgba(249,115,22,0.1);
    color: #818cf8;
}

.profile-section {
    padding: 12px 16px 4px;
}

.profile-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.3);
    padding: 4px 4px 8px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    text-align: left;
    text-decoration: none;
    color: white;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.profile-menu-item:active {
    background: rgba(255,255,255,0.08);
    transform: scale(0.99);
}

.profile-menu-item.danger {
    border-color: rgba(239,68,68,0.15);
    background: rgba(239,68,68,0.05);
}

.profile-menu-item > div:not(.profile-menu-icon) {
    flex: 1;
}

.profile-menu-item > div:not(.profile-menu-icon) p {
    font-size: 15px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.profile-menu-item.danger > div:not(.profile-menu-icon) p {
    color: #f87171;
}

.profile-menu-item > div:not(.profile-menu-icon) span {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.profile-menu-item > i.fa-chevron-right {
    color: rgba(255,255,255,0.25);
    font-size: 13px;
}

.profile-menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.profile-menu-icon.orange { background: rgba(249,115,22,0.2); color: #fb923c; }
.profile-menu-icon.purple { background: rgba(249,115,22,0.15); color: #fb923c; }
.profile-menu-icon.blue { background: rgba(59,130,246,0.2); color: #60a5fa; }
.profile-menu-icon.pink { background: rgba(236,72,153,0.2); color: #f472b6; }
.profile-menu-icon.green { background: rgba(16,185,129,0.2); color: #34d399; }
.profile-menu-icon.red { background: rgba(239,68,68,0.2); color: #f87171; }

.profile-sub-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.profile-sub-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.profile-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    gap: 8px;
    color: rgba(255,255,255,0.3);
}

.profile-orders-empty i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 8px;
}

.profile-orders-empty p {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
}

.profile-orders-empty span {
    font-size: 13px;
}

.profile-cta {
    margin-top: 16px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.profile-city-list {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-city-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    color: white;
    font-size: 15px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.profile-city-item.active {
    background: rgba(249,115,22,0.1);
    border-color: rgba(249,115,22,0.3);
    color: #818cf8;
}

.profile-city-item i:first-child {
    width: 20px;
    color: rgba(255,255,255,0.4);
}

.profile-city-item span { flex: 1; font-weight: 500; }

.check-icon {
    color: #f97316 !important;
    font-size: 16px;
}

/* ---- PRODUCT FEED MODAL ---- */
#feedModal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
}

#feedModal.active {
    display: block;
}

.feed-modal-container {
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.05, 0.64, 1);
}

#feedModal.active .feed-modal-container {
    transform: translateY(0);
}

.feed-modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(52px, calc(44px + env(safe-area-inset-top))) 16px 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.feed-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.feed-live-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

.feed-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-cards-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.feed-card {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.feed-card-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #111111;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transform: translateZ(0); /* Força GPU para melhor renderização */
    will-change: transform;
}

.feed-card-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.95) 0%,
        rgba(0,0,0,0.5) 40%,
        rgba(0,0,0,0.1) 70%,
        transparent 100%
    );
}

.feed-discount-badge {
    position: absolute;
    top: max(100px, calc(88px + env(safe-area-inset-top)));
    left: 16px;
    background: #ef4444;
    color: white;
    font-size: 13px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 10px;
    z-index: 5;
}

.feed-promo-badge {
    position: absolute;
    top: max(100px, calc(88px + env(safe-area-inset-top)));
    right: 72px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 10px;
    z-index: 5;
}

.feed-card-counter {
    position: absolute;
    top: max(100px, calc(88px + env(safe-area-inset-top)));
    right: 16px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 10px;
    z-index: 5;
}

.feed-card-content {
    position: relative;
    z-index: 10;
    padding: 16px 80px 16px 16px;
}

.feed-store-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 600;
}

.feed-store-logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.3);
    object-fit: cover;
}

.feed-product-name {
    font-size: 20px;
    font-weight: 800;
    color: white;
    line-height: 1.25;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.feed-product-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    line-height: 1.5;
    margin-bottom: 12px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.feed-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feed-price {
    font-size: 26px;
    font-weight: 900;
    color: #4ade80;
    text-shadow: 0 0 20px rgba(74,222,128,0.3);
}

.feed-old-price {
    font-size: 14px;
    color: rgba(255,255,255,0.4);
    text-decoration: line-through;
}

.feed-side-actions {
    position: absolute;
    right: 12px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
}

.feed-side-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.feed-side-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: all 0.2s;
}

.feed-side-icon.liked {
    background: rgba(239,68,68,0.3);
    border-color: rgba(239,68,68,0.5);
    color: #f87171;
}

.feed-side-btn span {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}

.feed-progress-bar {
    height: 3px;
    background: rgba(255,255,255,0.1);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
}

.feed-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f97316, #ea580c);
    transition: width 0.1s linear;
    width: 0%;
}

.feed-nav-dots {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 90px;
    display: flex;
    gap: 5px;
    z-index: 20;
}

.feed-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s;
}

.feed-dot.active {
    background: white;
    width: 16px;
    border-radius: 3px;
}

.feed-bottom-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px max(24px, calc(20px + env(safe-area-inset-bottom)));
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}

.feed-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.feed-nav-btn:active {
    background: rgba(249,115,22,0.3);
    transform: scale(0.95);
}

.feed-add-btn {
    flex: 1;
    height: 44px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(249,115,22,0.35);
    -webkit-tap-highlight-color: transparent;
}

.feed-add-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.feed-loading, .feed-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255,255,255,0.4);
}

.feed-loading p, .feed-empty p {
    font-size: 15px;
    font-weight: 600;
}

.feed-empty i {
    font-size: 48px;
    opacity: 0.3;
}

.feed-empty span {
    font-size: 13px;
}

.feed-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(249,115,22,0.3);
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---- RESPONSIVIDADE FEED ---- */
@media (max-width: 380px) {
    .feed-card-content {
        padding: 12px 70px 12px 12px;
    }
    .feed-product-name {
        font-size: 17px;
    }
    .feed-product-desc {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
    .feed-price {
        font-size: 22px;
    }
    .feed-side-icon {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    .feed-side-actions {
        right: 10px;
        gap: 12px;
    }
    .feed-bottom-actions {
        padding: 10px 12px max(20px, calc(16px + env(safe-area-inset-bottom)));
        gap: 10px;
    }
    .feed-nav-btn {
        width: 40px;
        height: 40px;
    }
    .feed-add-btn {
        height: 40px;
        font-size: 13px;
    }
    .feed-nav-dots {
        bottom: 75px;
    }
}

@media (max-height: 700px) {
    .feed-card-content {
        padding-bottom: 12px;
    }
    .feed-product-desc {
        -webkit-line-clamp: 1;
        margin-bottom: 8px;
    }
    .feed-nav-dots {
        bottom: 80px;
    }
}

@media (max-height: 600px) {
    .feed-product-desc {
        display: none;
    }
    .feed-nav-dots {
        bottom: 70px;
    }
}

/* ---- HIDDEN UTIL ---- */
.hidden { display: none !important; }
