/**
 * Narrator Chain Visualization Component CSS for Hadith Manager
 * Provides interactive visualization of narrator chains
 */

/* Main Container */
.narrator-chain-container {
    background: var(--white);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
    overflow: hidden;
    position: relative;
}

/* Header Styling */
.narrator-chain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.narrator-chain-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    position: relative;
    padding-left: 1.5rem;
}

.narrator-chain-header h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--primary-color);
    border-radius: 2px;
}

.narrator-chain-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-toggle-bio,
.btn-chain-layout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle-bio:hover,
.btn-chain-layout:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.narrator-language-selector select {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--white);
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%234b5563' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 0.75rem) center;
    padding-right: 2.5rem;
}

/* Chain Visualization Area */
.narrator-chain-visualization {
    position: relative;
    min-height: 200px;
}

.narrator-chain-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.narrator-chain-loading p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Chain Visualization Styles */
.chain-visualization {
    display: flex;
    padding: 1rem 0;
    overflow-x: auto;
    position: relative;
}

/* Vertical Layout (Default) */
.chain-visualization.vertical {
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    overflow-x: hidden;
}

/* Horizontal Layout */
.chain-visualization.horizontal {
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    padding-bottom: 2rem;
}

/* Chain Node Styling */
.chain-item {
    position: relative;
    max-width: 100%;
    transition: all 0.3s ease;
    margin: 10px 0;
}

.chain-node {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    margin: 0.5rem 0;
    background: var(--white);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    border: 1px solid var(--border-color);
    text-align: center;
    min-width: 200px;
}

.chain-node:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: rgba(16, 185, 129, 0.3);
}

/* Hide narrator avatars as requested */
.narrator-avatar {
    display: none;
}

.narrator-info {
    flex: 1;
    min-width: 0; /* Fixes flex truncation issue */
    text-align: center;
}

.narrator-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.narrator-lifespan {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin: 0;
}

.narrator-honorific {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border-radius: 12px;
    margin-top: 0.25rem;
}

.narrator-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 8px;
}

.btn-view-bio {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--light-bg);
    color: var(--primary-color);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-bio:hover {
    background: var(--primary-color);
    color: white;
}

/* Chain arrow styling */
.chain-arrow {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    color: #23DE00;
    font-size: 20px;
}

/* Emphasized arrow line */
.arrow-line {
    height: 30px;
    width: 2px;
    background-color: #23DE00;
    position: relative;
}

.arrow-line::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: -4px;
    width: 10px;
    height: 10px;
    border-right: 2px solid #23DE00;
    border-bottom: 2px solid #23DE00;
    transform: rotate(45deg);
}

/* Brief Narrator Bio */
.narrator-brief {
    display: none;
}

/* For compatibility with the existing chain structure */
.hadith-details-section .chain-visualization {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    margin: 20px auto;
}

.hadith-details-section .chain-item {
    text-align: center;
    margin: 5px 0;
}

.hadith-details-section .chain-node {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: inline-block;
    min-width: 200px;
}

.hadith-details-section .chain-node img {
    display: none;
}

.hadith-details-section .chain-node span {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.hadith-details-section .chain-arrow {
    margin: 5px 0;
    color: #23DE00;
    font-size: 16px;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .narrator-chain-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .narrator-chain-controls {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .chain-node {
        padding: 1rem;
    }
    
    .narrator-info {
        text-align: center;
    }
    
    .narrator-actions {
        justify-content: center;
    }
}

/* Narrator Bio Panel */
.narrator-bio-panel {
    position: fixed;
    top: 0;
    right: -450px; /* Off-screen initially */
    width: 100%;
    max-width: 450px;
    height: 100vh;
    background: var(--white);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.narrator-bio-panel.active {
    right: 0;
}

.narrator-bio-close {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
}

.btn-close-bio {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-bio:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.narrator-bio-content {
    padding: 0 1.5rem 2rem;
}

/* Narrator Biography Content */
.narrator-bio {
    color: var(--text-primary);
}

.bio-header {
    display: flex;
    margin-bottom: 2rem;
    gap: 1.5rem;
}

.bio-avatar {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid var(--primary-color);
    padding: 3px;
    background: white;
}

.bio-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.bio-meta {
    flex: 1;
}

.bio-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    color: var(--text-primary);
}

.bio-details {
    margin-bottom: 1rem;
}

.bio-kunya,
.bio-lifespan,
.bio-location,
.bio-generation {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bio-kunya {
    font-style: italic;
    color: var(--text-primary);
}

.bio-grading {
    margin-top: 1.5rem;
}

.bio-grading h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--text-primary);
}

.scholar-gradings {
    list-style: none;
    padding: 0;
    margin: 0;
}

.scholar-grading {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.grading-scholar {
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 0.25rem;
}

.grading-assessment {
    color: var(--text-secondary);
}

/* Biography Tabs */
.bio-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none; /* Firefox */
}

.bio-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.bio-tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.bio-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: transparent;
    transition: background 0.2s ease;
}

.bio-tab:hover {
    color: var(--primary-color);
}

.bio-tab.active {
    color: var(--primary-color);
}

.bio-tab.active::after {
    background: var(--primary-color);
}

.bio-tab-contents {
    position: relative;
}

.bio-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.bio-tab-content.active {
    display: block;
}

.bio-full-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.bio-full-text p {
    margin-bottom: 1rem;
}

/* Biography Hadith Count */
.bio-hadith-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--light-bg);
    border-radius: var(--card-radius);
}

.count-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.count-label {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
}

/* Biography Hadith List */
.bio-hadith-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bio-hadith-item {
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.bio-hadith-item:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(16, 185, 129, 0.3);
}

.hadith-ref {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.hadith-excerpt {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.hadith-link {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hadith-link:hover {
    background: rgba(16, 185, 129, 0.2);
}

/* Biography People List */
.bio-people-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.bio-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    text-align: center;
}

.bio-person:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(16, 185, 129, 0.3);
}

.person-avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 2px solid var(--primary-color);
    padding: 2px;
    background: white;
}

.person-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.person-info {
    flex: 1;
}

.person-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.person-brief {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.person-actions {
    margin-top: 0.75rem;
}

.btn-go-to-narrator,
.btn-view-person {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--light-bg);
    color: var(--primary-color);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-go-to-narrator:hover,
.btn-view-person:hover {
    background: var(--primary-color);
    color: white;
}

.no-people,
.no-hadiths,
.no-gradings {
    text-align: center;
    padding: 2rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.bio-no-data {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-tertiary);
}

/* Chain Error State */
.chain-error,
.chain-no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--white);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
}

.chain-error i,
.chain-no-data i {
    font-size: 2.5rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.chain-error p,
.chain-no-data p {
    margin: 0 0 1.5rem;
    color: var(--text-secondary);
}

.btn-retry {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-retry:hover {
    background: var(--primary-hover);
}

/* Animations */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .narrator-chain-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .narrator-chain-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .chain-node {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .narrator-avatar {
        width: 3rem;
        height: 3rem;
    }
    
    .narrator-info {
        width: calc(100% - 3.5rem - 2rem);
    }
    
    .narrator-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .narrator-bio-panel {
        right: -100%;
        max-width: 100%;
    }
    
    .bio-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .bio-people-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
} 