/* ═══ PATCH: Image & Gallery fixes ═══ */

/* Card image — use <img> instead of background */
.card-img {
    height: 180px;
    position: relative;
    background: #e8ecf1;
    overflow: hidden;
}
.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    opacity: .3;
    background: linear-gradient(135deg, #f0f2f5, #e2e6eb);
}

/* Gallery loader */
.gallery-loader {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

/* Gallery counter */
.gallery-counter {
    text-align: center;
    padding: 6px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

/* Modal gallery — horizontal scroll with snap */
.modal-gallery {
    height: 240px;
    overflow-x: auto;
    display: flex;
    gap: 2px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    position: relative;
    background: #f0f2f5;
}
.modal-gallery img {
    height: 100%;
    min-width: 100%;
    object-fit: cover;
    scroll-snap-align: start;
    flex-shrink: 0;
}
.modal-gallery::-webkit-scrollbar { display: none; }

/* Map preview image fix */
.preview-img {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    flex-shrink: 0;
    overflow: hidden;
    background: #e8ecf1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ═══ Tab content ═══ */
.tab-content {
    padding: 16px;
    padding-bottom: 80px;
    min-height: calc(100vh - 60px);
}
.tab-section { margin-bottom: 24px; }
.tab-heading {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--text);
}
.tab-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.tab-empty svg { margin-bottom: 12px; opacity: .4; }
.tab-empty-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.tab-empty-hint { font-size: 13px; line-height: 1.5; }
.tab-loading { text-align: center; padding: 40px; }

/* ═══ Alert form ═══ */
.alert-form { display: flex; flex-direction: column; gap: 12px; }
.alert-form-row label { font-size: 13px; font-weight: 500; color: var(--muted); display: block; margin-bottom: 4px; }
.alert-form-row select,
.alert-form-row input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e6eb;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}
.alert-price-row { display: flex; gap: 8px; }
.alert-price-row input { flex: 1; }
.alert-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}
.alert-check-label input { width: 18px; height: 18px; accent-color: var(--accent, #2563eb); }
.alert-save-btn { width: 100%; margin-top: 4px; }

/* Alert cards */
.alert-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f8f9fb;
    border-radius: 12px;
    margin-bottom: 8px;
}
.alert-info { font-size: 14px; font-weight: 500; color: var(--text); flex: 1; }
.alert-del {
    font-size: 12px;
    color: #ef4444;
    background: none;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 10px;
}

/* ═══ Favorites cards ═══ */
.fav-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #fff;
    border-radius: 14px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    cursor: pointer;
}
.fav-img {
    width: 64px; height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f2f5;
    flex-shrink: 0;
}
.fav-img img { width: 100%; height: 100%; object-fit: cover; }
.fav-info { flex: 1; min-width: 0; }
.fav-price { font-size: 15px; font-weight: 700; }
.fav-price span { font-size: 12px; font-weight: 400; color: var(--muted); }
.fav-title { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-meta { font-size: 12px; color: var(--muted); }
.fav-remove {
    background: none; border: none;
    font-size: 16px; color: #94a3b8; cursor: pointer;
    padding: 8px; flex-shrink: 0;
}

/* ═══ Profile ═══ */
.profile-section { text-align: center; padding-top: 30px; }
.profile-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.profile-name { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.profile-stats { display: flex; justify-content: center; gap: 32px; margin-bottom: 24px; }
.profile-stat-val { font-size: 22px; font-weight: 800; color: var(--accent, #2563eb); }
.profile-stat-label { font-size: 12px; color: var(--muted); }
.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fb;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 14px;
}
