/**
 * Social System Styles for Botemy
 */

/* =============================================================================
   Layout
   ============================================================================= */

.social-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

/* Navigation Tabs */
.social-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: var(--bg-hover);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn i {
    font-size: 16px;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Feed Header */
.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.feed-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* Filters */
.feed-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(55, 114, 255, 0.1);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(55, 114, 255, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-medium);
}

/* =============================================================================
   Story Cards
   ============================================================================= */

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.story-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-light);
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Posts grid and cards (Instagram-like posts) */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.post-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

/* Comments section inside a post card */
.post-comments-section {
    border-top: 1px solid var(--border-light);
    padding: 12px 16px;
    background: var(--bg-secondary);
}
.post-comments-section .comments-list {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 8px;
}
.post-comments-section .comment-item {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}
.post-comments-section .comment-author {
    font-weight: 600;
    color: var(--text-primary);
}
.post-comments-section .comment-date {
    font-size: 12px;
    color: var(--text-secondary);
}
.post-comments-section .comment-text {
    color: var(--text-primary);
    margin: 2px 0 4px;
}
.comment-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}
.comment-input-container .comment-field {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
}
.comment-input-container .comment-send-btn {
    white-space: nowrap;
}

/* Actions (likes, comments, shares) at the bottom of a post */
.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-top: 1px solid var(--border-light);
}

.post-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.post-actions button:hover {
    color: var(--primary-color);
}

.post-actions .liked i {
    color: var(--primary-color);
}

.post-actions i {
    font-size: 16px;
}

/* Poll styling */
.post-poll {
    padding: 16px;
    border-top: 1px solid var(--border-light);
}

.poll-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.poll-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.poll-option-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, color 0.2s ease;
}

.poll-option-btn:hover {
    background: var(--primary-color);
    color: var(--text-white);
}

.poll-option-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* =============================================================================
   Blogger Profile (Instagram-style)
   ============================================================================= */

/* Container for blogger profile header */
.blogger-profile-header {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

/* Avatar container */
.blogger-profile-avatar {
    flex-shrink: 0;
}

/* Avatar image */
.blogger-profile-avatar-img,
.blogger-profile-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 48px;
    font-weight: 700;
}

.blogger-profile-avatar-img {
    object-fit: cover;
}

/* Blogger info */
.blogger-profile-info h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.blogger-profile-bio {
    margin: 4px 0 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.blogger-profile-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
    font-size: 16px;
    flex-wrap: wrap;
}

.blogger-profile-stats span {
    color: var(--text-primary);
}

/* Posts grid for blogger profile */
/* Grid for displaying a blogger's posts. Use a fixed three-column layout with
   minimal spacing between items, mimicking Instagram's profile grid. */
.blogger-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

/* Each post in the blogger grid is a square without borders or shadows. */
.blogger-post-card {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    height: 0;
    padding-bottom: 100%; /* Maintain square aspect ratio */
}

.blogger-post-card img.blogger-post-media,
.blogger-post-card video.blogger-post-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Placeholder for text-only posts */
.blogger-post-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.post-media {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    display: block;
}

.post-content {
    padding: 16px;
    font-size: 15px;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* ---------------------------------------------------------------------------
 * User menu styling for the social network header
 *
 * Replicates the rounded button and dropdown style used in the main dashboard.
 */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    padding: 8px 14px;
    border-radius: 50px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.user-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px 0;
    display: none;
    z-index: 1001;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.user-dropdown .dropdown-item:hover {
    background: var(--bg-hover);
}

.story-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.story-card-content {
    padding: 20px;
}

.story-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.story-author {
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

.story-author:hover {
    text-decoration: underline;
}

.story-category {
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.story-title {
    font-size: 20px;
    font-weight: 700;
    margin: 10px 0;
    color: var(--text-primary);
    line-height: 1.4;
}

.story-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.story-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.story-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.story-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.story-stat i {
    font-size: 16px;
}

.story-actions {
    display: flex;
    gap: 8px;
}

.story-action-btn {
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.story-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* =============================================================================
   Bloggers Grid
   ============================================================================= */

.bloggers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.blogger-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 24px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-light);
}

.blogger-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.blogger-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 16px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    font-weight: 700;
}

.blogger-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.blogger-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 16px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.blogger-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.blogger-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.blogger-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* =============================================================================
   Challenges Grid
   ============================================================================= */

.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.challenge-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 24px;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-light);
}

.challenge-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.challenge-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.challenge-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.challenge-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.challenge-participants {
    font-size: 14px;
    color: var(--text-secondary);
}

/* =============================================================================
   Profile
   ============================================================================= */

.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 32px;
    border: 1px solid var(--border-light);
}

.profile-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.profile-card p {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 12px 0;
    line-height: 1.6;
}

/* =============================================================================
   Loading & Empty States
   ============================================================================= */

.loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

.error {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: var(--error-color);
}

/* =============================================================================
   Moderation Panel
   ============================================================================= */

.moderation-panel {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 24px;
    border: 1px solid var(--border-light);
}

.moderation-panel h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.moderation-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.moderation-item h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.moderation-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.moderation-actions {
    display: flex;
    gap: 12px;
}

.btn-approve {
    padding: 10px 20px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-approve:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-reject {
    padding: 10px 20px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reject:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

@media (max-width: 1024px) {
    .social-container {
        padding: 0 16px;
    }
    
    .stories-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 16px;
    }
    
    .bloggers-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .challenges-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .social-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .social-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .feed-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stories-grid,
    .bloggers-grid,
    .challenges-grid {
        grid-template-columns: 1fr;
    }
    
    .feed-filters {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .social-container {
        padding: 0 12px;
    }
    
    .feed-header h2 {
        font-size: 20px;
    }
    
    .story-card-content {
        padding: 16px;
    }
    
    .story-title {
        font-size: 18px;
    }
}

/* =============================================================================
   Dark Theme Support
   ============================================================================= */

[data-theme="dark"] .story-card,
[data-theme="dark"] .blogger-card,
[data-theme="dark"] .challenge-card,
[data-theme="dark"] .profile-card,
[data-theme="dark"] .moderation-panel,
[data-theme="dark"] .moderation-item {
    background: var(--bg-card);
    border-color: var(--border-light);
}

[data-theme="dark"] .story-category {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .filter-select {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-light);
}

/*
 * Header layout adjustments for the social network page.
 *
 * The social.html template wraps the standard dashboard header
 * structure (header-left / header-center / header-right) inside an
 * extra `.header-container` element. The base dashboard styles set
 * `.header` to use flexbox and space its direct children evenly, but
 * because there is only one child (the `.header-container`) the inner
 * elements end up stacking vertically and the logo image grows to its
 * intrinsic size.  Defining explicit flexbox rules on
 * `.header-container` reinstates the expected horizontal layout.  We
 * also center the page title and ensure the groups properly share
 * available space.
 */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 0 32px;
}

/* Centered page title in the social network header */
.header-center {
    flex: 1;
    text-align: center;
}

/* -----------------------------------------------------------------------------
   Comment modal styles
   The modal for viewing and adding comments on posts. Appears on top of the
   page and can be dismissed via the close button. Contains a scrollable list
   of comments and an input area for new comments.
*/
.modal-comments .modal-content {
    max-width: 500px;
    margin: auto;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.modal-comments .close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}
.comments-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 12px;
}
.comment-item {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}
.comment-date {
    font-size: 12px;
    color: var(--text-secondary);
}
.comment-text {
    margin: 4px 0;
    color: var(--text-primary);
}
.comment-input textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
}
.comment-input button {
    margin-top: 8px;
}
.empty-comments {
    color: var(--text-secondary);
    margin: 8px 0;
    text-align: center;
}

/*
 * Blogger profile editing and referral section
 * These styles apply to elements rendered in the My Profile tab and
 * general blogger profiles when referral code/link is displayed.
 */
.blogger-profile-edit {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.blogger-profile-edit h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.blogger-profile-edit label {
    display: block;
    margin-top: 8px;
    font-weight: 500;
}

.blogger-profile-edit textarea,
.blogger-profile-edit input[type="file"] {
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.blogger-profile-edit button {
    margin-top: 12px;
}

.blogger-profile-referral {
    margin-top: 16px;
    /* Add bottom margin to separate from posts grid */
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-secondary);
    font-size: 14px;
}

.blogger-profile-referral p {
    margin: 4px 0;
}

.referral-link-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}
