/* style-forum-answers.css */

/* --- General Section Styling --- */
.tbs-forum-answers-section {
    max-width: 900px; /* Added max-width for better control */
    margin: 40px auto; /* Centered with auto margins */
    background: #fff;
    border-radius: 00px; /* Slightly more rounded */
    box-shadow: 0 0px 005px rgba(0,0,0,0.0); /* Stronger, softer shadow */
    padding: 30px;
    border: 0px solid #e0e0e0; /* Lighter border */
    font-family: 'Inter', sans-serif; /* Consistent font */
}

.tbs-forum-answers-section h2 {
    font-size: 2.5em; /* Larger heading */
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center; /* Centered heading */
    border-bottom: 2px solid #f0f0f0; /* Thicker, lighter border */
    padding-bottom: 15px;
    font-weight: 700; /* Bolder */
}

.tbs-forum-answers-section h2 .answers-count {
    color: #ff5722; /* Accent color */
    font-weight: 600;
    margin-left: 10px;
}

/* --- Answer Submission Form --- */
.tbs-answer-form-wrapper {
    background: #f8f9fa; /* Lighter background */
    border: 2px dashed #d0d0d0; /* More prominent dashed border */
    border-radius: 16px; /* More rounded */
    padding: 30px;
    margin-bottom: 40px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); /* Subtle shadow */
}

.tbs-answer-form-wrapper h3 {
    font-size: 1.8em; /* Larger heading */
    color: #34495e;
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

#tbs-answer-submission-form textarea {
    width: 100%;
    min-height: 150px; /* Taller textarea */
    padding: 18px; /* More padding */
    border: 1px solid #bbb; /* Slightly darker border */
    border-radius: 10px; /* More rounded */
    font-size: 17px; /* Larger font */
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 20px; /* More space */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #ffffff; /* Explicit white background */
}

#tbs-answer-submission-form textarea:focus {
    border-color: #ff5722;
    box-shadow: 0 0 0 4px rgba(255, 87, 34, 0.2); /* Stronger glow */
    outline: none;
}

/* Image Upload Label (as button) */
.tbs-image-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 10px; /* More space */
    background-color: #3498db;
    color: white;
    padding: 12px 25px; /* Larger padding */
    border-radius: 10px; /* More rounded */
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    margin-bottom: 20px; /* More space */
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
}

.tbs-image-upload-label:hover {
    background-color: #217dbb;
    transform: translateY(-3px); /* More pronounced lift */
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3);
}

/* Image Preview */
.tbs-image-preview {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.tbs-image-preview-thumbnail {
    max-width: 180px; /* Larger preview */
    max-height: 180px;
    border: 2px solid #eee;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tbs-remove-image-button {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.tbs-remove-image-button:hover {
    background-color: #c0392b;
    transform: scale(1.1);
}

/* Submit Answer Button */
.tbs-submit-answer-button {
    background-color: #28a745;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    margin-top: 25px;
    box-shadow: 0 6px 15px rgba(40, 167, 69, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tbs-submit-answer-button:hover {
    background-color: #218838;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.35);
}

.tbs-form-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 50px;
    font-weight: 500;
    font-size: 1.05em;
}

.tbs-form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 5px solid #c3e6cb;
}

.tbs-form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.tbs-login-message {
    text-align: center;
    font-size: 1.2em;
    color: #555;
    background-color: #f0f4f7;
    border: 1px solid #dce0e3;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tbs-login-message a {
    color: #ff5722;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.2s ease;
}

.tbs-login-message a:hover {
    color: #e64a19;
    text-decoration: underline;
}

/* --- Answers List --- */
.tbs-answers-list {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.tbs-no-answers-message {
    text-align: center;
    color: #777;
    font-style: italic;
    padding: 25px;
    background-color: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #eee;
    font-size: 1.1em;
}

/* --- Single Answer Card --- */
.tbs-answer-card {
    background: #fdfdfd;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    padding: 25px;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tbs-answer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.tbs-answer-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f5f5f5;
}

.tbs-answer-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #3498db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tbs-answer-meta {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tbs-author-level {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.tbs-answer-author-name {
    font-weight: 700;
    color: #333;
    font-size: 1.2em;
}

.tbs-answer-author-name a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}
.tbs-answer-author-name a:hover {
    color: #ff5722;
}

/* User Level Badge - Answer Card */
.tbs-user-level-badge {
    background-color: transparent;
    color: #d97706;
    padding: 4px 0;
    border-radius: 0;
    font-size: 1.1em;
    font-weight: 700;
    text-transform: capitalize;
    animation: rainbow-text-animation 6s linear infinite;
    letter-spacing: 0.5px;
}

@keyframes rainbow-text-animation {
    0% { color: #FF0000; }
    14% { color: #FF7F00; }
    28% { color: #FFFF00; }
    42% { color: #00FF00; }
    57% { color: #0000FF; }
    71% { color: #4B0082; }
    85% { color: #9400D3; }
    100% { color: #FF0000; }
}


.tbs-answer-date {
    font-size: 0.9em;
    color: #888;
}

.tbs-answer-content {
    font-size: 1.1em;
    color: #333;
    line-height: 1.7;
    margin-bottom: 25px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Answer Image Display */
.tbs-answer-image-wrapper {
    margin-top: 20px;
    text-align: center;
}

.tbs-answer-image-thumbnail {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    object-fit: contain;
    cursor: zoom-in;
    transition: all 0.3s ease;
    border: 2px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tbs-answer-image-thumbnail.expanded {
    max-width: 95%;
    max-height: 90vh;
    cursor: zoom-out;
    border-color: #ff5722;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

/* --- Answer Footer (Reactions & Reply Button) --- */
.tbs-answer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px dashed #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.tbs-reaction-buttons {
    display: flex;
    gap: 10px;
}

.tbs-reaction-buttons button {
    background-color: #f0f4f7;
    color: #555;
    border: 1px solid #ccc;
    padding: 10px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
}

.tbs-reaction-buttons button:hover {
    background-color: #e0e6eb;
    border-color: #bbb;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tbs-reaction-buttons button.active {
    background-color: #ff5722;
    color: white;
    border-color: #e64a19;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

.tbs-reaction-buttons button.active:hover {
    background-color: #e64a19;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(255, 87, 34, 0.4);
}

/* MODIFIED Reply Button to be the Toggle button as well */
.tbs-toggle-replies { /* Class for the reply button that also toggles replies */
    background-color: #3498db;
    color: white;
    padding: 10px 22px;
    border-radius: 30px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
    display: flex; /* Make it a flex container to align icon and text */
    align-items: center;
    gap: 8px; /* Space between icon and text */
    justify-content: center; /* Center content horizontally */
}

.tbs-toggle-replies:hover {
    background-color: #217dbb;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3);
}

.tbs-toggle-replies .fas { /* Style for the Font Awesome icon inside the button */
    transition: transform 0.2s ease;
}

.tbs-toggle-replies .fa-reply-up { /* Icon when replies are shown (pointing upwards) */
    transform: rotate(180deg);
}

/* Replies Count Badge on the Reply button */
.tbs-replies-count-badge {
    background-color: #ff5722; /* Accent color */
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 5px;
    vertical-align: middle;
    display: inline-block;
}


/* --- Replies Section --- */
.tbs-replies-section {
    margin-top: 25px;
    padding-left: 30px;
    border-left: 0px solid #f0f0f0;
}

.tbs-replies-list-wrapper { /* Hidden by default, toggled by JS */
    display: none;
    margin-top: 15px; /* Space between toggle button and replies list */
}

.tbs-replies-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.tbs-reply-item {
    display: flex;
    gap: 15px;
    background-color: #fefefe;
    padding: 18px;
    border-radius: 30px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.tbs-reply-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #2ecc71;
}

.tbs-reply-content-wrapper {
    flex-grow: 1;
    position: relative;
}

.tbs-reply-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tbs-reply-author {
    font-weight: 700;
    color: #333;
    font-size: 1em;
}

.tbs-reply-author a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}
.tbs-reply-author a:hover {
    color: #ff5722;
}

/* User Level Badge - Reply Item (smaller) */
.tbs-user-level-badge-small {
    background-color: transparent;
    color: #d97706;
    padding: 3px 0;
    border-radius: 0;
    font-size: 0.9em;
    font-weight: 700;
    text-transform: capitalize;
    animation: rainbow-text-animation-small 6s linear infinite;
    letter-spacing: 0.5px;
}

@keyframes rainbow-text-animation-small {
    0% { color: #FF0000; }
    14% { color: #FF7F00; }
    28% { color: #FFFF00; }
    42% { color: #00FF00; }
    57% { color: #0000FF; }
    71% { color: #4B0082; }
    85% { color: #9400D3; }
    100% { color: #FF0000; }
}


.tbs-reply-date {
    font-size: 0.85em;
    color: #999;
}

.tbs-reply-text {
    font-size: 1em;
    color: #444;
    line-height: 1.6;
    margin-top: 0;
    margin-bottom: 0;
    white-space: pre-wrap;
}

/* Replies' Reaction Buttons (New Section) */
.tbs-reply-reaction-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tbs-reply-reaction-buttons button {
    background-color: #f7f7f7;
    color: #666;
    border: 1px solid #eee;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    font-weight: 500;
    cursor: pointer;
}

.tbs-reply-reaction-buttons button:hover {
    background-color: #e9e9e9;
    border-color: #ddd;
    transform: translateY(-1px);
}

.tbs-reply-reaction-buttons button.active {
    background-color: #ff8857;
    color: white;
    border-color: #ff6a33;
    box-shadow: 0 1px 5px rgba(255, 136, 87, 0.3);
}

.tbs-reply-reaction-buttons button.active:hover {
    background-color: #ff6a33;
}


/* Reply Form */
.tbs-reply-form-wrapper {
    margin-top: 20px;
    padding: 20px;
    background-color: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: inset 0 1px 5px rgba(0,0,0,0.05);
    display: none;
}

.tbs-reply-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.tbs-reply-form .tbs-submit-reply-button {
    background-color: #ffff66;
    color: white;
    padding: 10px 22px;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-right: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tbs-reply-form .tbs-submit-reply-button:hover {
    background-color: #ffff00;
    transform: translateY(-2px);
}

.tbs-reply-form .tbs-cancel-reply-button {
    background-color: #6c757d;
    color: white;
    padding: 10px 22px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tbs-reply-form .tbs-cancel-reply-button:hover {
    background-color: #5a6268;
}


/* --- Load More Answers Button --- */
.tbs-load-more-answers-section {
    text-align: center;
    margin-top: 40px;
}

/* Load More buttons styling */
.tbs-load-more-answers-section .btn-secondary,
.tbs-load-more-replies-section .btn-secondary {
    background-color: #ff0000; /* Info blue */
    color: white;
    padding: 12px 25px;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(91, 192, 222, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block; /* Ensure centering works */
}

.tbs-load-more-answers-section .btn-secondary:hover,
.tbs-load-more-replies-section .btn-secondary:hover {
    background-color: #31b0d5;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(91, 192, 222, 0.3);
}


/* Load More Replies Section (Centering) */
.tbs-load-more-replies-section {
    text-align: center; /* Center the button */
    margin-top: 20px; /* Space above the button */
    margin-bottom: 10px; /* Space below the button */
}


/* Fade-in Animation for dynamically loaded content */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

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

/* Responsive Adjustments (No direct flex overrides in this CSS for main layout) */
/* We want the theme's native layout to manage .row, .content-area, .forum-sidebar */

@media (max-width: 992px) { /* Tablet breakpoint: stack columns */
    .tbs-forum-answers-section {
        padding: 20px;
        margin: 20px auto; /* Center with margin auto on smaller screens */
        max-width: 100%; /* Ensure it takes full width of parent on smaller screens */
    }
}

@media (max-width: 768px) {
    /* Existing rules for 768px and smaller, ensuring mobile-friendliness */
    .tbs-forum-answers-section {
        padding: 20px;
    }
    .tbs-forum-answers-section h2 {
        font-size: 2em;
    }
    .tbs-answer-form-wrapper {
        padding: 20px;
    }
    .tbs-answer-form-wrapper h3 {
        font-size: 1.6em;
    }
    .tbs-answer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .tbs-answer-avatar {
        margin-bottom: 5px;
    }
    .tbs-answer-footer {
        flex-direction: column;
        align-items: center;
    }
    .tbs-reaction-buttons, .tbs-reply-button {
        width: 100%;
        justify-content: center;
    }
    .tbs-reply-button {
        margin-top: 10px;
    }
    .tbs-replies-section {
        padding-left: 15px;
    }
    .tbs-reply-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .tbs-reply-avatar {
        margin-bottom: 5px;
    }
    .tbs-reply-meta {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .tbs-forum-answers-section {
        padding: 15px;
        margin: 15px auto;
    }
    .tbs-forum-answers-section h2 {
        font-size: 1.8em;
    }
    .tbs-answer-form-wrapper h3 {
        font-size: 1.4em;
    }
    .tbs-reaction-buttons button {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    .tbs-reply-button {
        padding: 8px 18px;
        font-size: 0.95em;
    }
    .tbs-answer-avatar {
        width: 50px;
        height: 50px;
    }
    .tbs-reply-avatar {
        width: 35px;
        height: 35px;
    }
}