/**
 * Dictionary Index Styles
 * Beautiful, modern design for alphabetical dictionary index
 */

/* Main Container */
.bible-dictionary-index {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    direction: rtl;
    text-align: right;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Title Section */
.dictionary-index-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    color: #1a1a1a;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dictionary-index-description {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 40px;
}

/* Alphabetical Letters Grid */
.dictionary-letters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 15px;
    margin-bottom: 50px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.letter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    background: white;
    border-radius: 15px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.letter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

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

.letter-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.letter-char {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.letter-card:hover .letter-char {
    color: white;
}

.letter-count {
    font-size: 0.75rem;
    color: #999;
    margin-top: 5px;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.letter-card:hover .letter-count {
    color: rgba(255, 255, 255, 0.9);
}

.letter-card.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scale(1.1);
}

.letter-card.active .letter-char,
.letter-card.active .letter-count {
    color: white;
}

.letter-card.no-words {
    opacity: 0.4;
    cursor: not-allowed;
}

.letter-card.no-words:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Words Section */
.dictionary-words-section {
    min-height: 400px;
}

.words-section-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.no-selection {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.icon-book {
    margin: 0 auto 20px;
    color: #ddd;
}

.no-selection p {
    font-size: 1.2rem;
}

/* Words Grid */
.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.word-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.word-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.word-term {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
}

.view-definition-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-definition-btn:hover {
    transform: translateX(3px); /* RTL: move right on hover */
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.view-definition-btn svg {
    transition: transform 0.3s ease;
}

.view-definition-btn:hover svg {
    transform: translateX(-3px); /* RTL: arrow moves left (pointing direction) */
}

.no-words-message {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
}

/* Definition Modal */
.word-definition-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    color: #666;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.modal-close:hover {
    background: #667eea;
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 60px 40px 40px;
}

.definition-content {
    direction: rtl;
}

.definition-term {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.definition-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
}

.definition-text p {
    margin-bottom: 15px;
}

/* Verse Links in Definition (already styled by bible-frontend.css) */
.definition-text .dictionary-verse-link {
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s ease;
}

.definition-text .dictionary-verse-link:hover {
    color: #764ba2;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Loading State */
.words-list.loading {
    opacity: 0.5;
    pointer-events: none;
}

.words-list.loading::after {
    content: 'جاري التحميل...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dictionary-index-title {
        font-size: 2rem;
    }
    
    .dictionary-letters-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    .letter-card {
        padding: 15px 8px;
    }
    
    .letter-char {
        font-size: 1.5rem;
    }
    
    .words-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal-body {
        padding: 50px 25px 25px;
    }
    
    .definition-term {
        font-size: 1.5rem;
    }
    
    .definition-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .dictionary-letters-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .letter-card {
        padding: 12px 5px;
    }
    
    .letter-char {
        font-size: 1.3rem;
    }
    
    .letter-count {
        font-size: 0.65rem;
    }
}

/* Pagination Controls */
.pagination-controls {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.pagination-info {
    text-align: center;
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #667eea;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.page-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.page-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn:disabled:hover {
    transform: none;
    background: white;
    color: #667eea;
}

/* Print Styles */
@media print {
    .dictionary-letters-grid,
    .view-definition-btn,
    .modal-close,
    .pagination-controls {
        display: none;
    }
    
    .word-definition-modal {
        position: static;
    }
    
    .modal-overlay {
        display: none;
    }
    
    .modal-content {
        box-shadow: none;
        max-height: none;
    }
}
