/* Modern Topic Detail Styles */
.topic-detail-container {
    padding: 0;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    min-height: 100vh;
}

/* Breadcrumb Section */
.breadcrumb-section {
    padding: 1rem 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: var(--text-sm);
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--text-muted);
    font-weight: 600;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--primary-dark);
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* Topic Hero Section */
.topic-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 50%, var(--accent-color) 100%);
    color: white;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
}

.topic-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><pattern id="topic-grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="20" fill="url(%23topic-grid)"/></svg>');
    opacity: 0.3;
}

.topic-hero-content {
    position: relative;
    z-index: 2;
    
}

.topic-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.topic-type-review {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.topic-type-general {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.topic-hero h1 {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 800;
    line-height: var(--leading-tight);
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, rgba(255,255,255,1), rgba(255,255,255,0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.topic-rating-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: fit-content;
}

.topic-rating-stars {
    display: flex;
    gap: 0.25rem;
}

.topic-rating-stars i {
    font-size: 1.25rem;
    color: #fbbf24;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.topic-rating-text {
    font-size: 1.25rem;
    font-weight: 700;
}

.topic-author-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.topic-author-avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.topic-author-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: var(--text-xl);
    font-weight: 700;
}

.topic-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: var(--text-sm);
    opacity: 0.9;
}

.topic-meta-info span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Content Card */
.topic-content-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    margin: -2rem auto 3rem;
    position: relative;
    overflow: hidden;
}

.topic-content-body {
    padding: 2.5rem;
}

.topic-product-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
    border: 1px solid var(--border-light);
    transition: all var(--transition-normal);
}

.topic-product-info:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.2);
}

.topic-product-image {
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius-lg);
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.topic-product-name {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.topic-product-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all var(--transition-fast);
}

.topic-product-link:hover {
    color: var(--primary-dark);
    transform: translateX(4px);
}

.topic-content {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
}

.topic-content h1, .topic-content h2, .topic-content h3,
.topic-content h4, .topic-content h5, .topic-content h6 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.topic-content p {
    margin-bottom: 1.5rem;
}

.topic-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin: 1.5rem 0;
    transition: all var(--transition-normal);
}

.topic-content img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

.topic-content blockquote {
    border-left: 4px solid var(--primary-color);
    background: var(--bg-secondary);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--radius-lg);
    font-style: italic;
}

.topic-content code {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
    color: var(--text-primary);
}

.topic-content pre {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* Topic Footer */
.topic-footer {
    padding: 2rem 2.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.topic-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.topic-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
}

.topic-stat i {
    font-size: 1.125rem;
}

.reply-button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-xl);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.reply-button:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* Replies Section */
.replies-section {
    margin: 0 auto 3rem;
}

.replies-header {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1.5rem 2rem;
    border-bottom: none;
}

.replies-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reply-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-top: none;
    padding: 2rem;
    transition: all var(--transition-normal);
    position: relative;
}

.reply-card:last-child {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.reply-card:hover {
    background: var(--bg-secondary);
    border-color: rgba(37, 99, 235, 0.2);
}

.reply-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.reply-card:hover::before {
    opacity: 1;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.reply-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.reply-author-info h6 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
    font-weight: 600;
}

.reply-date {
    color: var(--text-muted);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.reply-content {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
}

.reply-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin: 1rem 0;
}

/* No Replies State */
.no-replies-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    margin: 0 auto 3rem;
}

.no-replies-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-replies-state h4 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Reply Form */
.reply-form-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin: 0 auto 3rem;
}

.reply-form-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
}

.reply-form-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><pattern id="reply-grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="20" fill="url(%23reply-grid)"/></svg>');
    opacity: 0.3;
}

.reply-form-header h4 {
    margin: 0;
    font-weight: 700;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.reply-form-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
    resize: vertical;
    min-height: 150px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--bg-primary);
}

.form-text {
    font-size: var(--text-xs);
    margin-top: 0.5rem;
    display: block;
}

.text-muted { color: var(--text-muted); }
.text-warning { color: var(--warning-color); }
.text-success { color: var(--success-color); }

.submit-reply-button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: var(--text-base);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.submit-reply-button:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.submit-reply-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.submit-reply-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.submit-reply-button:hover::before {
    left: 100%;
}

/* Related Topics */
.related-topics-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin: 0 auto 3rem;
}

.related-topics-header {
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.related-topics-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-topics-grid {
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-topic-card {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
}

.related-topic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.2);
}

.related-topic-title {
    margin: 0 0 1rem 0;
    font-size: var(--text-sm);
    line-height: var(--leading-tight);
}

.related-topic-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.related-topic-title a:hover {
    color: var(--primary-color);
}

.related-topic-meta {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.related-topic-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--reading-progress, 0%);
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    z-index: 1000;
    transition: width 0.1s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .topic-hero {
        padding: 2rem 0;
    }
    
    .topic-hero h1 {
        font-size: 1.75rem;
    }
    
    .topic-author-section {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .topic-meta-info {
        justify-content: center;
    }
    
    .topic-content-card {
        margin: -1rem 1rem 2rem;
        border-radius: var(--radius-xl);
    }
    
    .topic-content-body {
        padding: 1.5rem;
    }
    
    .topic-footer {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .topic-stats {
        justify-content: center;
    }
    
    .reply-form-section,
    .related-topics-section,
    .replies-section {
        margin-left: 1rem;
        margin-right: 1rem;
    }
    
    .reply-form-body {
        padding: 1.5rem;
    }
    
    .related-topics-grid {
        padding: 1.5rem;
        grid-template-columns: 1fr;
    }
    
    .reply-card {
        padding: 1.5rem;
    }
    
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .topic-rating-display {
        width: 100%;
        justify-content: center;
    }
    
    .topic-product-info {
        flex-direction: column;
        text-align: center;
    }
    
    .reply-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .related-topics-grid {
        padding: 1rem;
    }
    
    .related-topic-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* Dark theme support */
.dark-theme .topic-content-card,
.dark-theme .reply-card,
.dark-theme .reply-form-section,
.dark-theme .related-topics-section,
.dark-theme .no-replies-state {
    background: var(--bg-secondary);
    border-color: var(--border-dark);
}

.dark-theme .related-topic-card {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

.dark-theme .topic-footer,
.dark-theme .replies-header,
.dark-theme .related-topics-header {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

/* High contrast support */
@media (prefers-contrast: high) {
    .topic-content-card,
    .reply-card,
    .reply-form-section,
    .related-topics-section {
        border-width: 2px;
    }
    
    .topic-type-badge,
    .reply-button,
    .submit-reply-button {
        border: 2px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .topic-content-card,
    .reply-card,
    .related-topic-card,
    .reply-button,
    .submit-reply-button,
    .back-to-top {
        transition: none;
    }
    
    .topic-content-card:hover,
    .reply-card:hover,
    .related-topic-card:hover {
        transform: none;
    }
    
    .reply-button:hover,
    .submit-reply-button:hover,
    .back-to-top:hover {
        transform: none;
    }
}

/* Animation classes */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

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

/* Loading states */
.loading-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast notification styles */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

.toast-notification {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 1rem;
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification.hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast-notification.success {
    border-left: 4px solid var(--success-color);
}

.toast-notification.warning {
    border-left: 4px solid var(--warning-color);
}

.toast-notification.error {
    border-left: 4px solid var(--error-color);
}

.toast-notification.info {
    border-left: 4px solid var(--info-color);
}