.zalo-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #f4f5f7;
    z-index: 999999;
    display: none; /* hidden by default */
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.zalo-search-modal.active {
    display: flex;
}

.zalo-search-modal * {
    box-sizing: border-box;
}

/* Header */
.zsm-header {
    background-color: #0088FF;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 12px;
}

.zsm-back-btn, .zsm-qr-btn {
    background: none;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.zsm-back-btn .material-icons-outlined {
    font-size: 24px;
}

.zsm-qr-btn .material-icons-outlined {
    font-size: 24px;
}

.zsm-search-box {
    flex: 1;
    background-color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: 36px;
}

.zsm-search-icon {
    color: #888;
    font-size: 20px;
    margin-right: 8px;
}

.zsm-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 15px;
    background: transparent;
}

.zsm-input::placeholder {
    color: #999;
}

/* Tabs */
.zsm-tabs {
    display: flex;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
}

.zsm-tab {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 15px;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    position: relative;
}

.zsm-tab.active {
    color: #0088FF;
}

.zsm-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background-color: #0088FF;
}

/* Content */
.zsm-content {
    background-color: white;
    display: flex;
    flex-direction: column;
}

.zsm-section {
    padding: 15px 15px 5px 15px;
}

.zsm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.zsm-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #000;
    margin: 0;
}

.zsm-edit-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
}

/* Grids */
.zsm-miniapp-grid {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.zsm-miniapp-grid::-webkit-scrollbar {
    display: none;
}

.zsm-contact-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.zsm-contact-list::-webkit-scrollbar {
    display: none;
}

.zsm-miniapp-item, .zsm-contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    flex-shrink: 0;
}

.zsm-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.zsm-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zsm-avatar-wrapper {
    width: 52px;
    height: 52px;
    position: relative;
    margin-bottom: 8px;
}

.zsm-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    object-fit: cover;
}

.zsm-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background-color: #ff9800;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.zsm-item-name {
    font-size: 12px;
    color: #333;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.zsm-divider {
    height: 8px;
    background-color: #f4f5f7;
    width: 100%;
}

.zsm-footer {
    padding: 30px 0;
    text-align: center;
    background-color: #f4f5f7;
    flex: 1; /* take up remaining space if lists are short */
}

.zsm-history-link {
    color: #666;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
