/* Styles for templates/activity/post_detail.html. Loaded via {% block extra_css %}
   so video, photo carousel, comment list, mention dropdown, and bracket rules
   are cached by the browser instead of shipped inline on every request. */

.post-caption {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.post-description {
    font-size: 0.85rem;
    font-weight: 400;
    color: #333;
    line-height: 1.5;
}

.post-video-container {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
}

.post-video-container.landscape {
    aspect-ratio: 16/9;
}

.post-video-container.portrait {
    aspect-ratio: 9/16;
    max-height: 80vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

@media (max-width: 576px) {
    .post-video-container.portrait {
        aspect-ratio: 9/16;
        max-height: 85vh;
    }
}

/* Blur background for portrait videos (Instagram/TikTok style) */
.video-blur-bg {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: cover;
    background-position: center;
    filter: blur(30px);
    z-index: 0;
    opacity: 1;
}

.post-video {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 2;
    opacity: 1;
}

/* Ensure video controls are clickable above blur background */
.post-video::-webkit-media-controls {
    z-index: 3;
}

.post-video-container video {
    cursor: pointer;
}

.video-duration-badge {
    position: absolute;
    bottom: 60px;
    right: 12px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}


.post-photos-container {
    position: relative;
}

.post-photos {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.post-photos::-webkit-scrollbar {
    display: none;
}

.post-photo-wrapper {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: start;
}

.post-photo {
    width: 100%;
    height: auto;
    display: block;
}

.photo-indicators {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.photo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.photo-dot.active {
    background: white;
    transform: scale(1.2);
}

.photo-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 10;
}



.post-owner-actions {
    display: flex;
    gap: 4px;
}

.player-link {
    cursor: pointer;
    transition: opacity 0.2s;
}

.player-link:hover {
    opacity: 0.8;
}

.player-link:hover .player-name {
    color: #667eea !important;
}

.player-link img,
.player-link .rounded-circle {
    transition: transform 0.2s;
}

.player-link:hover img,
.player-link:hover .rounded-circle {
    transform: scale(1.05);
}

/* Modern Comment Section Styles */
.comments-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.75rem;
    margin: 0 -0.5rem;
}

.comment-msg {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: flex-start;
    animation: fadeInUp 0.2s ease-out;
}

.comment-msg.own {
    flex-direction: row-reverse;
}

.comment-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    margin-top: 18px;
}

.comment-msg-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-msg-avatar-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-green), var(--brand-green-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.7rem;
}

.comment-msg-wrapper {
    max-width: 75%;
}

.comment-msg.own .comment-msg-wrapper {
    text-align: right;
}

.comment-msg-name {
    font-size: 0.7rem;
    color: #22c55e;
    font-weight: 600;
    margin-bottom: 0.15rem;
    padding-left: 0.75rem;
}

.comment-msg-name a {
    color: #22c55e;
    text-decoration: none;
}

.comment-msg-name a:hover {
    text-decoration: underline;
}

.comment-msg-content {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
    text-align: left;
}

.comment-msg.other .comment-msg-content {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.comment-msg.own .comment-msg-content {
    background: linear-gradient(135deg, var(--brand-green), var(--brand-green-hover));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(20, 83, 45, 0.25);
}

.comment-msg.own .comment-msg-content a.mention-link {
    color: #d4fce4;
}

.comment-msg-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.15rem;
    padding: 0 0.75rem;
}

.comment-msg.own .comment-msg-meta {
    justify-content: flex-end;
}

.comment-msg-time {
    font-size: 0.65rem;
    color: #94a3b8;
}

/* Modern Inline Comment Form */
.comment-form-inline {
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
}

.comment-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-avatar-sm {
    flex-shrink: 0;
}

.comment-avatar-sm img,
.avatar-fallback-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-fallback-sm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-input-box {
    flex: 1;
    position: relative;
}

.comment-input-box textarea {
    width: 100%;
    background: transparent;
    border: none;
    padding: 8px 0;
    color: #333;
    font-size: 0.95rem;
    resize: none;
    min-height: 36px;
    max-height: 100px;
    line-height: 1.4;
    outline: none;
}

.comment-input-box textarea::placeholder {
    color: #adb5bd;
}

.btn-send-comment {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.5;
}

.btn-send-comment:not(:disabled) {
    opacity: 1;
}

.btn-send-comment:not(:disabled):hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-send-comment:disabled {
    cursor: not-allowed;
}

.comment-helper-text {
    text-align: right;
    padding: 4px 8px 0;
}

.comment-helper-text .char-counter {
    font-size: 0.75rem;
    color: #adb5bd !important;
}

/* Ensure comment section text is readable */
.comments-section h6,
.comments-section .fw-bold {
    color: #333 !important;
}

/* Force comment author link color */
.comment-bubble .comment-author,
.comment-header .comment-author,
a.comment-author {
    color: #1a1a1a !important;
}

.char-counter {
    color: #666 !important;
}

.char-counter span,
.char-counter .text-muted,
#charCount {
    color: #666 !important;
}

.comment-textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Mention Dropdown */
.mention-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.mention-dropdown.show {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mention-item:hover, .mention-item.active {
    background: rgba(102, 126, 234, 0.2);
}

.mention-item:first-child {
    border-radius: 12px 12px 0 0;
}

.mention-item:last-child {
    border-radius: 0 0 12px 12px;
}

.mention-item:only-child {
    border-radius: 12px;
}

.mention-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.mention-avatar-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mention-name {
    font-weight: 500;
    color: #333;
}

.mention-following {
    font-size: 0.7rem;
    color: #667eea;
    margin-left: auto;
}

/* Comment Actions */
.comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-counter {
    font-size: 0.8rem;
}

.btn-comment-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-comment-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-comment-submit:active {
    transform: translateY(0);
}

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

.mention-link {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.mention-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.comment-like-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.comment-like-btn:hover {
    color: #ff4757;
}

.comment-like-btn.liked {
    color: #ff4757;
}

.comment-like-count {
    color: #94a3b8;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Empty Comments */
.empty-comments {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-comments .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-comments p {
    margin: 0;
    font-weight: 500;
    color: #666;
}

.empty-comments span {
    font-size: 0.85rem;
}

.feed-bracket-wrap {
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
}
.feed-bracket-container {
    overflow-x: auto;
    padding: 10px 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.feed-bracket-container::-webkit-scrollbar { display: none; }
.feed-bracket-tree {
    display: flex;
    align-items: stretch;
    min-width: max-content;
}
.feed-bracket-round {
    display: flex;
    flex-direction: column;
    min-width: 130px;
    max-width: 130px;
}
.feed-bracket-round-title {
    font-size: 0.6rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
    padding: 0 0 6px;
    white-space: nowrap;
}
.feed-bracket-matches {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 4px;
    padding: 0 3px;
}
.feed-bracket-match-wrap { position: relative; }
.feed-bracket-match {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.feed-bracket-match.completed { border-color: #bbf7d0; }
.feed-bracket-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    font-size: 0.65rem;
    color: #666;
}
.feed-bracket-player:first-child { border-bottom: 0.5px solid #f5f5f5; }
.feed-bracket-player.winner { color: #22c55e; font-weight: 700; }
.feed-bracket-player.tbd { color: #ccc; }
.feed-bracket-score { font-weight: 700; font-size: 0.65rem; }
.feed-bracket-winner-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 0 4px;
}
.feed-bracket-winner-name {
    font-size: 0.65rem;
    font-weight: 800;
    color: #22c55e;
    text-align: center;
    white-space: nowrap;
}
.feed-bracket-round:not(:first-child) .feed-bracket-matches .feed-bracket-match-wrap::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 50%;
    width: 3px;
    height: 1.5px;
    background: #e0e0e0;
}
.feed-bracket-round:not(:first-child) .feed-bracket-matches .feed-bracket-match-wrap.completed-path::before {
    background: #bbf7d0;
}
