/* Share and Public Feed Styles */

/* Discover Section (热门 + 公开) */
.discover-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 12px;
}

.discover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.discover-tabs {
    display: inline-flex;
    gap: 0.5rem;
    background: #ededf7;
    padding: 0.35rem;
    border-radius: 999px;
}

.discover-tab {
    border: none;
    background: transparent;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    transition: all 0.2s;
}

.discover-tab.active {
    background: #fff;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.discover-search {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex: 1;
    min-width: 260px;
}

.discover-search input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.discover-search input:focus {
    outline: none;
    border-color: #667eea;
}

.discover-body {
    margin-top: 1.25rem;
}

/* 瀑布流布局 - 使用CSS column-count */
.discover-grid {
    column-count: 4;
    column-gap: 1rem;
}

.discover-grid .share-card {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.discover-grid .share-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.discover-grid .share-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.discover-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #999;
}

.discover-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.discover-pagination span {
    color: #666;
    font-weight: 500;
}

/* Card layout shared by 热门/公开 */
.top-shares-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.top-share-item {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.top-share-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.top-share-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.top-share-info {
    padding: 0.75rem;
}

.top-share-prompt {
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.top-share-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #999;
}

.top-share-username {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Search Bar in Public Feed */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
}

.search-bar button {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

/* Like Button */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.like-btn:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.like-btn.liked {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border-color: #ff6b6b;
    color: white;
}

.like-btn .like-icon {
    font-size: 1rem;
}

.like-btn .like-count {
    font-weight: 500;
}

/* Share Button */
.share-btn {
    transition: all 0.2s;
}

.share-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.share-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.2s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

input:disabled + .slider {
    background: #e0e0e0;
    cursor: not-allowed;
}

.share-toggle-row {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-state-text {
    font-size: 0.9rem;
    color: #555;
}

/* Responsive Adjustments */
@media (min-width: 1200px) {
    .discover-grid {
        column-count: 5;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .discover-grid {
        column-count: 4;
    }
}

@media (min-width: 769px) and (max-width: 991px) {
    .discover-grid {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .top-shares-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .discover-grid {
        column-count: 2;
        column-gap: 0.75rem;
    }

    .top-share-item img {
        height: 150px;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .top-shares-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .discover-grid {
        column-count: 1;
    }
}
