/* Thread View Styles */

.thread-container {
    padding: 20px 0;
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* Thread Header (now part of thread content) */
.thread-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1rem;
}

.thread-title {
    color: #2c3e50;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.thread-meta {
    color: #6c757d;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.thread-author {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.thread-meta a {
    color: #007bff;
    text-decoration: none;
}

.thread-meta a:hover {
    text-decoration: underline;
}

.thread-date {
    text-align: right;
    white-space: nowrap;
}

.thread-date small {
    font-size: 0.85rem;
    color: #6c757d;
}

.thread-actions .btn {
    border-radius: 6px;
    font-weight: 500;
}

/* Thread Content */
.thread-content .card {
    border: 2px solid #e9ecef;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    position: relative;
    overflow: hidden;
}

/* Thread Content Layout */
.thread-content .card-body {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Author Column (Left Side) - Using existing site pattern */
.thread-author-column {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.thread-author-column .user_pnl {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
    text-align: center;
}

.thread-author-column .user_pnl .img {
    width: 80px;
    height: 80px;
    border: 1px solid #e9ecef;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    padding: 0;
    margin: 0 0 1rem 0;
}

.thread-author-column .user_pnl .img img {
    object-fit: cover;
    object-position: top;
    width: 100%;
    height: 100%;
}

.thread-author-column .user_pnl .text {
    padding: 0;
    margin: 0;
    text-align: center;
}

.thread-author-column .user_pnl .text h3 {
    font-size: 1.1rem;
    line-height: 1.2;
    font-weight: 600;
    color: #2c3e50;
    padding: 0;
    margin: 0 0 0.5rem 0;
}

.thread-author-column .user_pnl .text h3 a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.2s ease;
}

.thread-author-column .user_pnl .text h3 a:hover {
    color: #007bff;
    text-decoration: underline;
}

.thread-author-column .user_pnl .text .location {
    font-size: 0.9rem;
    line-height: 1.2;
    color: #6c757d;
    font-weight: 400;
    padding: 0;
    margin: 0;
}

/* Content Column (Right Side) */
.thread-content-column {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
    border-left: 1px solid #e9ecef;
    padding-left: 30px;
}

.thread-message {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #2c3e50;
    font-weight: 400;
    padding: 1rem 0;
}

/* Threaded Reply Structure */
.replies-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 3px solid #e9ecef;
    position: relative;
}

.replies-section::before {
    content: 'Replies';
    position: absolute;
    top: -15px;
    left: 0;
    background: white;
    padding: 0 1rem;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}



/* Base reply item styling */
.reply-item {
    position: relative;
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

/* Level 1 replies (replies to the main thread) */
.reply-item .card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: box-shadow 0.2s ease;
    background: white;
}

/* Level 2 replies (replies to replies) */
.reply-item.reply-level-1 {
    margin-left: 3rem !important;
}

.reply-item.reply-level-1 .card {
    background: #f8f9fa !important;
}

/* Level 3+ replies (max depth - treat same as level 2) */
.reply-item.reply-level-2 {
    margin-left: 4rem !important;
}

.reply-item.reply-level-2 .card {
    background: #f0f8ff !important;
}

/* Nested replies container */
.nested-replies {
    margin-top: 1rem;
}

/* Hover effects */
.thread-content .card:hover {
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.reply-item .card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: box-shadow 0.2s ease;
}

/* Reply to indicator */
.reply-to-indicator {
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
}

/* Reply location */
.reply-location {
    margin-bottom: 0.25rem;
}

.reply-location small {
    font-size: 0.8rem;
    color: #6c757d;
}

.reply-location i {
    font-size: 0.75rem;
}

/* Reply date */
.reply-date {
    text-align: right;
    white-space: nowrap;
}

.reply-date small {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Reply Layout (3 Columns) */
.reply-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

/* Column 1: Author Info */
.reply-author-column {
    flex: 0 0 200px;
    display: flex;
    align-items: flex-start;
}

.reply-author-column .avatar {
    flex-shrink: 0;
}

.reply-author-column h6 {
    margin-bottom: 0.25rem;
}

/* Column 2: Reply Content */
.reply-content-column {
    flex: 1;
    min-width: 0;
    border-left: 1px solid #e9ecef;
    padding-left: 30px;
}

.reply-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
}

/* Column 3: Date and Actions */
.reply-actions-column {
    flex: 0 0 120px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.reply-date {
    margin-bottom: 1rem;
}

.reply-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Reply footer */
.reply-footer {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.reply-badges {
    display: flex;
    align-items: center;
}

/* Replies Section */
.replies-section h3 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
}



.reply-author h6 a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.reply-author h6 a:hover {
    text-decoration: underline;
}

.reply-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
}

.reply-actions .btn {
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Global override for primary buttons to use irace blue */
.btn-primary {
    background-color: #039BE5 !important;
    border-color: #039BE5 !important;
    color: white !important;
}

.btn-primary:hover {
    background-color: #0288D1 !important;
    border-color: #0288D1 !important;
    color: white !important;
}

.btn-primary:focus {
    background-color: #0288D1 !important;
    border-color: #0288D1 !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(3, 155, 229, 0.25) !important;
}

.btn-primary:active {
    background-color: #0277BD !important;
    border-color: #0277BD !important;
    color: white !important;
}

/* Custom irace blue button */
.btn-irace-blue {
    background-color: #039BE5;
    border-color: #039BE5;
    color: white;
    transition: all 0.2s ease-in-out;
}

.btn-irace-blue:hover {
    background-color: #0288D1;
    border-color: #0288D1;
    color: white;
}

.btn-irace-blue:focus {
    background-color: #0288D1;
    border-color: #0288D1;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(3, 155, 229, 0.25);
}

.btn-irace-blue:active {
    background-color: #0277BD;
    border-color: #0277BD;
    color: white;
}

.solution-badge .badge {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

/* Reply Form */
.reply-form-section .card {
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    margin-top: 2rem;
}

.reply-form-section .card-header {
    background: #f8f9fa;
    color: #333;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
}

.reply-form-section .card-header h5 {
    margin: 0;
    font-weight: 600;
}

.reply-form-section .form-control {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: border-color 0.2s ease;
}

.reply-form-section .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.reply-form-section .btn-primary {
    background: #039BE5;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.reply-form-section .btn-primary:hover {
    background: #0288D1;
}

/* Avatar */
.avatar img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
    .thread-title {
        font-size: 1.5rem;
    }
    
    .thread-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .thread-actions {
        margin-top: 1rem;
        width: 100%;
    }
    
    .thread-actions .btn {
        width: 100%;
    }
    
    .reply-actions {
        margin-top: 1rem;
    }
    
    .reply-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Mobile threading adjustments */
    .reply-item {
        margin-left: 1rem;
    }
    
    .reply-item.reply-level-1 {
        margin-left: 1.5rem;
    }
    
    .reply-item.reply-level-2 {
        margin-left: 2rem;
    }
    
    /* Mobile thread content layout */
    .thread-content .card-body {
        flex-direction: column;
        gap: 1rem;
    }
    
    .thread-author-column {
        flex: none;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
         .thread-author-column .user_pnl .img {
         width: 60px;
         height: 60px;
     }
     
     /* Mobile reply adjustments */
     .reply-layout {
         flex-direction: column;
         gap: 1rem;
     }
     
     .reply-author-column {
         flex: none;
         width: 100%;
     }
     
     .reply-content-column {
         flex: none;
         width: 100%;
     }
     
     .reply-actions-column {
         flex: none;
         width: 100%;
         text-align: left;
         align-items: flex-start;
     }
     
     .reply-actions {
         flex-direction: row;
         gap: 0.5rem;
     }
 }
