/**
 * Story Comments & Rating Styles
 * Responsive: Mobile-first approach
 */

/* ===== STICKY TABS NAVIGATION ===== */
.story-tabs {
    position: sticky;
    top: 60px;
    background: var(--bg, #0a0a0a);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tab-btn {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-secondary, #888);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    -webkit-user-select: none;
    user-select: none;
}

.tab-btn:hover {
    color: var(--text, #e8e8e8);
}

.tab-btn.active {
    color: var(--primary, #ff6b35);
}

.tab-count {
    font-size: 11px;
    opacity: 0.8;
    background: var(--bg-secondary, #1a1a1a);
    padding: 2px 6px;
    border-radius: 10px;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.tab-btn.active .tab-count {
    background: var(--primary, #ff6b35);
    color: white;
}

/* Mobile Tabs */
@media (max-width: 768px) {
    .story-tabs {
        top: 0;
        padding: 12px;
        gap: 8px;
    }
    
    .tab-btn {
        flex: 1;
        padding: 12px 8px;
        background: var(--bg-secondary, #1a1a1a);
        border-radius: 8px;
        flex-direction: column;
        font-size: 12px;
        gap: 4px;
    }
    
    .tab-btn span:first-child {
        font-size: 20px;
    }
    
    .tab-btn.active {
        background: var(--primary, #ff6b35);
        color: white;
    }
    
    .tab-count {
        font-size: 10px;
        position: absolute;
        top: 4px;
        right: 4px;
        min-width: 18px;
        text-align: center;
    }
}

/* Desktop Tabs */
@media (min-width: 769px) {
    .story-tabs {
        top: 60px;
        justify-content: center;
        padding: 12px 24px;
        gap: 16px;
    }
    
    .tab-btn {
        padding: 10px 20px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
    }
    
    .tab-btn:hover {
        background: var(--bg-secondary, #1a1a1a);
    }
    
    .tab-btn.active {
        background: var(--primary, #ff6b35);
        color: white;
    }
    
    .tab-btn.active:hover {
        opacity: 0.9;
    }
}

/* ===== TAB CONTENT ===== */
.tab-content {
    min-height: 200px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== RATING SECTION ===== */
.rating-section {
    background: var(--bg-card, #141414);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}

.rating-summary {
    text-align: center;
    margin-bottom: 16px;
}

.rating-big {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary, #ff6b35);
    line-height: 1;
}

.rating-stars-display {
    font-size: 24px;
    color: #ffc107;
    margin: 8px 0;
    letter-spacing: 4px;
}

.rating-count {
    color: var(--text-secondary, #888);
    font-size: 14px;
}

/* Rating Input */
.rating-input-container {
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.rating-input-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text, #e8e8e8);
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.star-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 8px;
    font-size: 36px;
    margin-bottom: 12px;
}

.star-input span {
    cursor: pointer;
    color: var(--text-muted, #666);
    transition: color 0.2s;
    line-height: 1;
}

.star-input span:hover,
.star-input span:hover ~ span {
    color: #ffc107;
}

.star-input span.active {
    color: #ffc107;
}

.rating-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg, #0a0a0a);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 8px;
    padding: 12px;
    color: var(--text, #e8e8e8);
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
    font-family: inherit;
}

.rating-textarea:focus {
    outline: none;
    border-color: var(--primary, #ff6b35);
}

.rating-textarea::placeholder {
    color: var(--text-muted, #666);
}

.rating-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary, #ff6b35);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.rating-submit-btn:hover {
    opacity: 0.9;
}

.rating-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Desktop Rating Layout */
@media (min-width: 769px) {
    .rating-section {
        display: grid;
        grid-template-columns: 200px 1fr;
        gap: 24px;
        padding: 24px;
    }
    
    .rating-summary {
        text-align: center;
        border-right: 1px solid var(--border, rgba(255,255,255,0.08));
        padding-right: 24px;
    }
    
    .rating-big {
        font-size: 64px;
    }
    
    .rating-input-container {
        margin-top: 0;
    }
}

/* ===== COMMENTS SECTION ===== */
.comments-section {
    padding: 16px 0;
}

/* Comment Form */
.comment-form {
    background: var(--bg-card, #141414);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.comment-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #ff6b35), #e55a2b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.comment-user-info {
    flex: 1;
}

.comment-username {
    font-weight: 600;
    color: var(--text, #e8e8e8);
    font-size: 14px;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.comment-hint {
    font-size: 12px;
    color: var(--text-muted, #666);
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.comment-textarea-wrapper {
    position: relative;
}

.comment-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text, #e8e8e8);
    font-size: 15px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--primary, #ff6b35);
}

.comment-textarea::placeholder {
    color: var(--text-muted, #666);
}

.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.comment-form-hint {
    font-size: 12px;
    color: var(--text-muted, #666);
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.comment-submit-btn {
    padding: 10px 24px;
    background: var(--primary, #ff6b35);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.comment-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Comment Filters */
.comments-filters {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.comments-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 20px;
    color: var(--text-secondary, #888);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    -webkit-user-select: none;
    user-select: none;
}

.filter-btn:hover {
    border-color: var(--primary, #ff6b35);
    color: var(--text, #e8e8e8);
}

.filter-btn.active {
    background: var(--primary, #ff6b35);
    border-color: var(--primary, #ff6b35);
    color: white;
}

/* Comment List */
.comments-list {
    padding: 8px 0;
}

.comment-item {
    padding: 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    transition: background 0.2s;
}

.comment-item:hover {
    background: rgba(255,255,255,0.02);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 0;
}

/* Facebook-style comment layout */
.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-bubble {
    background: var(--bg-secondary, #2a2a2a) !important;
    border-radius: 16px !important;
    padding: 8px 12px !important;
    display: inline-block !important;
    max-width: 100% !important;
}

.comment-bubble .comment-author {
    font-weight: 600 !important;
    color: var(--text, #e4e6eb) !important;
    font-size: 13px !important;
    margin-bottom: 2px !important;
}

.comment-bubble .comment-content {
    margin-left: 0 !important;
    color: var(--text-secondary, #b0b3b8) !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

.comment-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    margin-left: 12px;
}

.comment-action-link {
    background: none;
    border: none;
    color: var(--text-muted, #65676b);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.comment-action-link:hover {
    color: var(--text-secondary, #b0b3b8);
    text-decoration: underline;
}

.comment-action-link.active {
    color: var(--primary, #ff6b35);
}

.comment-likes-count {
    font-size: 12px;
    color: var(--text-muted, #65676b);
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.comment-author {
    font-weight: 600;
    color: var(--text, #e8e8e8);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.comment-author-badge {
    background: var(--primary, #ff6b35);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.comment-time {
    font-size: 12px;
    color: var(--text-muted, #65676b);
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
    font-weight: 400;
}

.comment-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.comment-rating {
    color: #ffc107;
    font-size: 12px;
    letter-spacing: 1px;
}

.comment-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted, #666);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.comment-menu-btn:hover {
    background: var(--bg-secondary, #1a1a1a);
    color: var(--text, #e8e8e8);
}

.comment-content p {
    margin: 0;
}

/* Old comment actions - hide when using new layout */
.comment-actions {
    display: none;
}

/* Facebook-style comment layout */
.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-bubble {
    background: var(--bg-secondary, #2a2a2a);
    border-radius: 16px;
    padding: 8px 12px;
    display: inline-block;
    max-width: 100%;
}

.comment-bubble .comment-author {
    font-weight: 600;
    color: var(--text, #e4e6eb);
    font-size: 13px;
    margin-bottom: 2px;
}

.comment-bubble .comment-content {
    margin-left: 0;
    margin-top: 0;
    color: var(--text-secondary, #b0b3b8);
    font-size: 14px;
    line-height: 1.4;
}

.comment-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    margin-left: 12px;
}

.comment-action-link {
    background: none;
    border: none;
    color: var(--text-muted, #65676b);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.comment-action-link:hover {
    color: var(--text-secondary, #b0b3b8);
    text-decoration: underline;
}

.comment-action-link.active {
    color: var(--primary, #ff6b35);
}

.comment-likes-count {
    font-size: 12px;
    color: var(--text-muted, #65676b);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Desktop Comments */
@media (min-width: 769px) {
    .comments-section {
        padding: 24px;
    }
    
    .comment-form {
        padding: 24px;
        margin-bottom: 24px;
    }
    
    .comment-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .comment-bubble {
        padding: 10px 14px;
    }
    
    .comment-bubble .comment-author {
        font-size: 14px;
    }
    
    .comment-bubble .comment-content {
        font-size: 15px;
    }
    
    .comment-item {
        padding: 12px 24px;
    }
}

/* ===== EMPTY STATE ===== */
.comments-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary, #888);
}

.comments-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.comments-empty-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.comments-empty-hint {
    font-size: 14px;
    opacity: 0.7;
}

/* ===== LOADING STATE ===== */
.comment-skeleton {
    padding: 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--bg-secondary, #1a1a1a) 25%, var(--bg-card, #141414) 50%, var(--bg-secondary, #1a1a1a) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-right: 12px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== FLOATING ACTION BUTTON (Mobile) ===== */
.fab-menu {
    position: fixed;
    bottom: 84px;
    right: 16px;
    z-index: 1000;
    display: none;
}

@media (max-width: 768px) {
    .fab-menu {
        display: block;
    }
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary, #ff6b35);
    color: white;
    border: none;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
    -webkit-user-select: none;
    user-select: none;
}

.fab-main:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255,107,53,0.4);
}

.fab-main.active {
    transform: rotate(45deg);
}

.fab-actions {
    position: absolute;
    bottom: 68px;
    right: 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.fab-menu.open .fab-actions {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fab-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card, #141414);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-user-select: none;
    user-select: none;
}

.fab-action-btn:hover {
    transform: scale(1.1);
    background: var(--bg-secondary, #1a1a1a);
}

.fab-label {
    position: absolute;
    right: 56px;
    background: var(--bg-card, #141414);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text, #e8e8e8);
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s;
    pointer-events: none;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.fab-action-btn:hover .fab-label {
    opacity: 1;
    transform: translateX(0);
}

/* ===== LOGIN PROMPT ===== */
.login-prompt {
    text-align: center;
    padding: 32px 24px;
    background: var(--bg-card, #141414);
    border-radius: 12px;
    margin: 16px 0;
}

.login-prompt-icon {
    font-size: 40px;
    margin-bottom: 12px;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.login-prompt-text {
    color: var(--text-secondary, #888);
    margin-bottom: 16px;
    font-size: 14px;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.login-prompt-btn {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary, #ff6b35);
    color: white;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.login-prompt-btn:hover {
    opacity: 0.9;
}

/* ===== REVIEWS TAB (PC Stats) ===== */
.reviews-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 24px;
}

.review-stat-card {
    background: var(--bg-card, #141414);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.review-stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary, #ff6b35);
}

.review-stat-label {
    font-size: 13px;
    color: var(--text-secondary, #888);
    margin-top: 4px;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.rating-bars {
    padding: 24px;
    background: var(--bg-card, #141414);
    border-radius: 12px;
    margin: 16px;
}

.rating-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.rating-bar-star {
    font-size: 14px;
    color: #ffc107;
    min-width: 40px;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.rating-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 4px;
    overflow: hidden;
}

.rating-bar-fill {
    height: 100%;
    background: var(--primary, #ff6b35);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.rating-bar-count {
    min-width: 50px;
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary, #888);
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}
/* ===== RATING FORM CONTAINER ===== */
/* Modal overlay styles defined in story.css — do not duplicate here */

/* Modal styles are defined in story-toc.css */

/* Edit form - Facebook style */
.comment-edit-bubble {
    background: var(--bg-secondary, #2a2a2a);
    border-radius: 16px;
    padding: 12px;
    margin-left: 52px;
}

.comment-edit-textarea {
    width: 100%;
    min-height: 60px;
    background: var(--bg, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text, #e4e6eb);
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
    margin-bottom: 8px;
}

.comment-edit-textarea:focus {
    outline: none;
    border-color: var(--primary, #ff6b35);
}

.comment-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.comment-save-btn,
.comment-cancel-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}

.comment-save-btn {
    background: var(--primary, #ff6b35);
    color: white;
}

.comment-cancel-btn {
    background: var(--bg, #1a1a1a);
    color: var(--text-secondary, #b0b3b8);
}

.comment-save-btn:hover,
.comment-cancel-btn:hover {
    opacity: 0.9;
}
