/**
 * Word Analysis Component CSS for Hadith Manager
 * Provides interactive word-by-word breakdown of Arabic text
 */

/* Word Analysis Container */
.word-analysis-container {
    position: relative;
    direction: rtl;
    line-height: 2;
    margin: 1rem 0;
}

/* Arabic Word Styling */
.arabic-word {
    display: inline-block;
    position: relative;
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    padding: 0.1rem 0.3rem;
    margin: 0 0.1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.word-analysis-active .arabic-word {
    background-color: rgba(16, 185, 129, 0.05);
    border-bottom: 1px dashed rgba(16, 185, 129, 0.3);
}

.word-analysis-active .arabic-word:hover {
    background-color: rgba(16, 185, 129, 0.1);
    transform: translateY(-2px);
}

.word-analysis-active .arabic-word:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* Word Tooltip */
.word-tooltip {
    font-family: 'Roboto', sans-serif;
    direction: ltr;
    padding: 0.5rem;
    min-width: 150px;
    text-align: left;
}

.word-translation {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.word-root,
.word-grammar,
.word-form {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.tooltip-hint {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-style: italic;
    margin-top: 0.3rem;
}

/* Word Detail Popup */
.word-detail-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.word-detail-content {
    position: relative;
    background-color: var(--white);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.word-detail-arrow {
    position: absolute;
    top: -10px;
    width: 20px;
    height: 10px;
    overflow: hidden;
}

.word-detail-arrow::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--white);
    transform: translateY(50%) rotate(45deg);
    top: 0;
    left: 3px;
    box-shadow: var(--shadow-sm);
}

.word-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.word-detail-header h3 {
    font-family: 'Amiri', serif;
    font-size: 2rem;
    margin: 0;
    color: var(--text-primary);
}

.word-detail-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.word-detail-close:hover {
    color: var(--text-primary);
}

.word-detail-body {
    padding: 1.5rem;
}

/* Word Detail Tabs */
.word-detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.word-tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.word-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: transparent;
    transition: background 0.2s ease;
}

.word-tab:hover {
    color: var(--primary-color);
}

.word-tab.active {
    color: var(--primary-color);
}

.word-tab.active::after {
    background: var(--hadith-primary-color, var(--primary-color, #40b910));
}

.word-tab-content {
    display: none;
}

.word-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Word Info Section */
.word-info-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.word-root-info,
.word-grammar-info,
.word-form-info {
    display: flex;
    align-items: baseline;
}

.info-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 0.5rem;
    min-width: 100px;
}

.root-text {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.grammar-text,
.form-text {
    color: var(--text-secondary);
}

/* Translations Section */
.word-translations {
    margin-bottom: 1.5rem;
}

.word-translations h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.word-translation-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: var(--white);
}

.translation-language {
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.translation-text {
    color: var(--text-secondary);
}

/* Morphology Section */
.word-morphology {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.morphology-item {
    display: flex;
    padding: 0.75rem;
    background: var(--light-bg);
    border-radius: 6px;
}

.morphology-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 0.5rem;
    min-width: 120px;
}

.morphology-value {
    color: var(--text-secondary);
}

/* Usage Examples */
.word-usage {
    margin-bottom: 1.5rem;
}

.word-usage h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.usage-example {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: var(--white);
}

.example-arabic {
    font-family: 'Amiri', serif;
    font-size: 1.3rem;
    text-align: right;
    direction: rtl;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.example-translation {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.example-source {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Conjugation Tables */
.conjugation-table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.conjugation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.conjugation-table th,
.conjugation-table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.conjugation-table th {
    background: var(--light-bg);
    font-weight: 500;
    color: var(--text-primary);
}

.conjugation-table td {
    color: var(--text-secondary);
}

.conjugation-table .person-label,
.conjugation-table .case-label,
.conjugation-table .property-label {
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(16, 185, 129, 0.05);
}

.conjugation-form,
.declension-form,
.property-value {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
}

/* No Data State */
.no-data,
.no-translations {
    padding: 2rem;
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Loading Indicator */
.word-analysis-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.9);
    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(--hadith-primary-color, var(--primary-color, #40b910));
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Language Selector */
#word-analysis-language-container {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

#word-analysis-language {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .word-detail-tabs {
        flex-wrap: wrap;
    }
    
    .word-tab {
        flex-grow: 1;
        text-align: center;
        padding: 0.75rem 1rem;
    }
    
    .info-label {
        min-width: 80px;
    }
    
    .morphology-label {
        min-width: 100px;
    }
    
    .conjugation-table {
        font-size: 0.85rem;
    }
    
    .conjugation-form,
    .declension-form,
    .property-value {
        font-size: 1rem;
    }
    
    .word-detail-popup {
        padding: 1rem 0.5rem;
    }
    
    .word-detail-content {
        max-height: 90vh;
    }
} 