/**
 * assets/css/pages/topic_view.css - Topic view page styles
 * Author: pourdaryaei (https://pourdaryaei.ir)
 */

/* ============================================================
   TOPIC HEADER
   ============================================================ */
.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.topic-header-left h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.4rem;
}

/* ============================================================
   TOPIC STATUS BAR
   ============================================================ */
.topic-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.topic-status-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--text-muted);
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-secondary:hover {
    background: #5a6e8a;
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #e67e22);
    color: #000;
    padding: 8px 18px;
    border-radius: 40px;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-warning:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #1e8c7c);
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-success:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c82333);
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-danger:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
}

.status-badge.locked {
    background: rgba(230, 57, 70, 0.15);
    color: var(--danger);
    border: 1px solid rgba(230, 57, 70, 0.3);
}

.status-badge.resolved {
    background: rgba(46, 196, 182, 0.15);
    color: var(--success);
    border: 1px solid rgba(46, 196, 182, 0.3);
}

/* ============================================================
   POST CARD
   ============================================================ */
.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 20px 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-card.post-pending {
    opacity: 0.95;
    border-left: 4px solid var(--warning);
    background: rgba(248, 150, 30, 0.05);
}

html[dir="rtl"] .post-card.post-pending {
    border-left: none;
    border-right: 4px solid var(--warning);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--surface-light);
    border-bottom: 2px solid var(--border);
}

.post-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.post-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    padding: 4px 10px;
    border-radius: 20px;
}

.pending-badge {
    display: inline-block;
    background: var(--warning);
    color: #000;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 10px;
}

html[dir="rtl"] .pending-badge {
    margin-left: 0;
    margin-right: 10px;
}

/* ============================================================
   POST BODY & AVATAR
   ============================================================ */
.post-body {
    display: flex;
    align-items: flex-start;
    gap: 25px;
    padding: 10px;
    min-height: 200px;
}

.post-avatar-section {
    position: relative;
    text-align: center;
    min-width: 140px;
    padding: 15px 10px;
    background: rgba(67, 97, 238, 0.05);
    border-radius: var(--radius);
}

.post-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    cursor: pointer;
}

.post-display-name {
    font-weight: 700;
    margin-top: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.post-user-info {
    margin-top: 12px;
    font-size: 0.7rem;
    line-height: 1.6;
    text-align: center;
}

.post-username {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    direction: ltr;
}

.ltr-username {
    direction: ltr !important;
    display: inline-block;
}

.post-user-stats {
    color: var(--primary);
    font-size: 0.65rem;
    margin-bottom: 6px;
}

.post-user-ip {
    margin: 8px 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(67, 97, 238, 0.1);
    padding: 4px 8px;
    border-radius: 20px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.post-user-ip:hover {
    background: rgba(67, 97, 238, 0.2);
    transform: scale(1.02);
}

.post-rank-stars {
    font-size: 0.7rem;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

.post-rank-name {
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.pm-icon {
    display: inline-block;
    margin-top: 8px;
    color: var(--primary);
    font-size: 1rem;
    transition: 0.2s;
}

.post-content-wrapper {
    flex: 1;
    min-height: 200px;
    display: block;
    align-items: center;
}

.post-content {
    line-height: 1.8;
    width: 100%;
}

/* ============================================================
   POST FOOTER & ACTION BUTTONS
   ============================================================ */
.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--surface-light);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.footer-left {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Like/Dislike Bar */
.like-dislike-bar {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--surface-light);
    padding: 2px;
    border-radius: 40px;
}

.like-btn, .dislike-btn {
    background: transparent;
    border: none;
    padding: 5px 12px;
    min-width: 50px;
    height: 34px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.like-btn i, .dislike-btn i {
    font-size: 0.85rem;
}

.like-count, .dislike-count {
    font-size: 0.7rem;
    font-weight: 600;
}

.like-btn {
    color: var(--success);
}

.like-btn.active {
    background: var(--success);
    color: white;
}

.dislike-btn {
    color: var(--danger);
}

.dislike-btn.active {
    background: var(--danger);
    color: white;
}

.like-btn:hover:not(.active),
.dislike-btn:hover:not(.active) {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

@keyframes likePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.like-btn:active i, .dislike-btn:active i {
    animation: likePop 0.2s ease;
}

/* Action Buttons Group */
.action-buttons-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.action-buttons-group .btn-success,
.action-buttons-group .btn-primary,
.action-buttons-group .btn-warning,
.action-buttons-group .btn-danger {
    padding: 6px 14px;
    min-width: 70px;
    height: 36px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 500;
}

.action-buttons-group i {
    font-size: 0.85rem;
}

/* ============================================================
   REPLY FORM
   ============================================================ */
.post-form {
    margin: 30px auto;
    padding: 25px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.post-form h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.post-form textarea {
    width: 100%;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    min-height: 120px;
    resize: vertical;
    margin-bottom: 15px;
    font-family: var(--font-main);
}

/* Markdown Toolbar */
.markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
    background: var(--surface-light);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.markdown-toolbar button {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.markdown-toolbar button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.bbcode-hint {
    background: var(--surface-light);
    border-radius: 12px;
    border-top: 3px solid var(--primary);
    padding: 12px 15px;
    margin: 15px 0;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.bbcode-hint .hint-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.bbcode-hint i {
    margin-right: 6px;
}

html[dir="rtl"] .bbcode-hint i {
    margin-right: 0;
    margin-left: 6px;
}

.form-actions {
    margin-top: 15px;
}

/* ============================================================
   LOGIN TO REPLY BOX
   ============================================================ */
.login-to-reply-box {
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, var(--surface-light), var(--surface));
    border-radius: var(--radius);
    margin-top: 30px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.login-to-reply-box h4 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.login-to-reply-box p {
    margin-bottom: 25px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-to-reply-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.page-link:hover, .page-link.current {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================================
   ROLE BADGES
   ============================================================ */
.topic-role-badge {
    position: absolute;
    top: 5px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 10;
    border: 2px solid var(--surface);
    cursor: default;
    background: var(--surface-light);
}

.topic-admin-badge {
    background: linear-gradient(135deg, #e63946, #b91c2c);
    color: white;
}

.topic-moderator-badge {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

html[dir="ltr"] .topic-role-badge {
    left: 5px;
    right: auto;
}

html[dir="rtl"] .topic-role-badge {
    right: 5px;
    left: auto;
}

/* ============================================================
   COPY TOAST
   ============================================================ */
.copy-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 0.8rem;
    z-index: 10001;
    animation: fadeInOut 1.5s ease;
    pointer-events: none;
    white-space: nowrap;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ============================================================
   INFO & ERROR BOXES
   ============================================================ */
.info-box, .error-box {
    padding: 12px 18px;
    border-radius: 12px;
    margin: 15px 0;
    text-align: center;
}

.info-box {
    background: rgba(67, 97, 238, 0.1);
    border-left: 3px solid var(--primary);
}

.error-box {
    background: rgba(230, 57, 70, 0.15);
    border: 1px solid var(--danger);
    color: #ff8a92;
}

/* ============================================================
   GUEST HIDDEN CONTENT STYLES
   ============================================================ */
.guest-hidden-link,
.guest-hidden-image,
.guest-hidden-gallery {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    width: auto;
    min-width: 220px;
}

.guest-hidden-link:hover,
.guest-hidden-image:hover,
.guest-hidden-gallery:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ============================================================
   NEW POSTS BADGE - Blue dot indicator for unread topics
   Like Discourse - shows which topics have new posts since last visit
   ============================================================ */

/* Container for the badge */
.new-posts-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

/* The blue dot itself */
.new-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.7);
    animation: pulse-new 2s infinite;
    transition: all 0.2s ease;
}

/* Pulse animation for attention-grabbing effect */
@keyframes pulse-new {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.7);
        transform: scale(0.95);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(67, 97, 238, 0);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(67, 97, 238, 0);
        transform: scale(0.95);
    }
}

/* Tooltip text that appears on hover */
.new-tooltip {
    display: none;
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    background: var(--surface);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    z-index: 10;
    font-weight: 500;
    pointer-events: none;
}

/* Small arrow for the tooltip */
.new-tooltip::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Show tooltip on hover */
.new-posts-badge:hover .new-tooltip {
    display: block;
}

/* RTL support */
html[dir="rtl"] .new-posts-badge {
    margin-left: 0;
    margin-right: 8px;
}

html[dir="rtl"] .new-tooltip {
    left: 50%;
    transform: translateX(-50%);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .new-dot {
        width: 8px;
        height: 8px;
    }
    
    .new-tooltip {
        font-size: 0.6rem;
        padding: 3px 8px;
        top: -28px;
    }
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .post-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }
    
    .post-avatar-section {
        width: 100%;
        min-width: auto;
    }
    
    .post-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .post-footer {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-right {
        justify-content: center;
    }
    
    .topic-status-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .topic-status-buttons {
        justify-content: center;
    }
    
    .post-avatar {
        width: 70px;
        height: 70px;
    }
    
    /* Hide text on action buttons in mobile */
    .action-buttons-group .btn-success,
    .action-buttons-group .btn-primary,
    .action-buttons-group .btn-warning,
    .action-buttons-group .btn-danger {
        padding: 6px 10px;
        min-width: 36px;
        justify-content: center;
    }
    
    .action-buttons-group .action-text {
        display: none;
    }
    
    /* Hide text on like/dislike buttons in mobile */
    .like-btn .like-count,
    .dislike-btn .dislike-count {
        display: none;
    }
    
    .like-btn, .dislike-btn {
        padding: 5px 8px;
        min-width: 36px;
    }
    
    /* Send reply button on mobile */
    .btn-primary .btn-text {
        display: none;
    }
    
    .btn-primary {
        padding: 6px 14px;
    }
    
    .btn-primary i {
        margin: 0;
    }
    
    .guest-hidden-link,
    .guest-hidden-image,
    .guest-hidden-gallery {
        padding: 8px 16px;
        font-size: 0.75rem;
        min-width: 180px;
    }
}

/* ============================================================
   DESKTOP - Show text on buttons
   ============================================================ */
@media (min-width: 769px) {
    .action-text {
        display: inline-block;
    }
    
    .btn-text {
        display: inline-block;
    }
    
    .like-count, .dislike-count {
        display: inline-block;
    }
}

/* ============================================================
   EXTRA SMALL DEVICES
   ============================================================ */
@media (max-width: 480px) {
    .post-body {
        padding: 16px;
    }
    
    .post-avatar {
        width: 60px;
        height: 60px;
    }
    
    .post-avatar-section {
        min-width: auto;
        padding: 10px;
    }
    
    .action-buttons-group {
        gap: 6px;
    }
    
    .action-buttons-group .btn-success,
    .action-buttons-group .btn-primary,
    .action-buttons-group .btn-warning,
    .action-buttons-group .btn-danger {
        padding: 5px 8px;
        min-width: 32px;
    }
    
    .like-btn, .dislike-btn {
        padding: 4px 6px;
        min-width: 32px;
    }
    
    .topic-status-buttons {
        gap: 8px;
    }
    
    .btn-secondary,
    .btn-warning,
    .btn-success,
    .btn-danger {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}

/* ============================================================
   RTL SUPPORT
   ============================================================ */
body[dir="rtl"] .post-user-stats i {
    margin-right: 0;
    margin-left: 3px;
}

body[dir="rtl"] .footer-right,
body[dir="rtl"] .action-buttons-group,
body[dir="rtl"] .topic-status-buttons {
    flex-direction: row-reverse;
}

body[dir="rtl"] .btn-secondary i,
body[dir="rtl"] .btn-warning i,
body[dir="rtl"] .btn-success i,
body[dir="rtl"] .btn-danger i {
    transform: scaleX(-1);
}
