/**
 * LCTC Chapter Reader - Styles
 * Compact selector and popup modal styling
 */

/* ===== Compact Chapter Selector (Toolbar Style) ===== */
.lctc-chapter-selector-wrapper {
    margin: 10px 0;
    display: inline-block;
    vertical-align: middle;
}

.lctc-chapter-selector-compact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.lctc-chapter-selector-group {
    display: none !important; /* Force hidden - only show button */
    align-items: center;
    gap: 8px;
}

.lctc-chapter-selector-group label {
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

.lctc-chapter-book-select,
.lctc-chapter-num-select {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lctc-chapter-book-select {
    min-width: 150px;
}

.lctc-chapter-num-select {
    min-width: 70px;
}

.lctc-chapter-book-select:hover,
.lctc-chapter-num-select:hover {
    background: #ffffff;
    border-color: rgba(255, 255, 255, 0.5);
}

.lctc-chapter-book-select:focus,
.lctc-chapter-num-select:focus {
    outline: none;
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.lctc-chapter-open-btn {
    padding: 0 12px;
    background: #ffffff;
    color: #667eea;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 36px;
    height: 36px !important;
    max-height: 36px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lctc-chapter-open-btn:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.lctc-chapter-open-btn:active {
    transform: translateY(0);
}

/* ===== Modal Popup ===== */
.lctc-chapter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.lctc-chapter-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.lctc-chapter-modal-content {
    position: relative;
    background: #ffffff;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

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

/* ===== Popup Header ===== */
.lctc-chapter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.lctc-chapter-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.lctc-chapter-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.lctc-chapter-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ===== Popup Body ===== */
.lctc-chapter-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #f8f9fa;
}

.lctc-chapter-loading {
    text-align: center;
    padding: 60px 20px;
}

.lctc-chapter-loading .spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.lctc-chapter-loading p {
    margin-top: 20px;
    color: #666;
    font-size: 16px;
}

/* Force hide loading when not needed */
#lctc-chapter-loading[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#lctc-chapter-loading[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===== Chapter Text ===== */
.lctc-chapter-text {
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#lctc-chapter-text[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.lctc-chapter-verses {
    line-height: 1.8;
}

.lctc-verse-item {
    margin: 0 0 15px 0;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.lctc-verse-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #e8eaf6 0%, #f3e5f5 100%);
    color: #5e35b1;
    font-weight: 700;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
    border: 2px solid #9575cd;
}

.lctc-verse-number:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.lctc-verse-text {
    flex: 1;
    color: #333;
    font-size: 16px;
    line-height: 1.7;
}

/* ===== Popup Footer ===== */
.lctc-chapter-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
}

.lctc-chapter-nav-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lctc-chapter-nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.lctc-chapter-nav-btn:active:not(:disabled) {
    transform: translateY(0);
}

.lctc-chapter-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lctc-chapter-nav-info {
    color: #666;
    font-weight: 600;
    font-size: 15px;
}

/* ===== Error State ===== */
.lctc-chapter-error {
    text-align: center;
    padding: 60px 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
}

.lctc-chapter-error p {
    color: #856404;
    font-size: 16px;
    margin: 0;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .lctc-chapter-selector-wrapper {
        margin: 8px 0;
        display: inline-block;
        width: auto;
    }
    
    .lctc-chapter-selector-compact {
        display: inline-flex;
        flex-wrap: nowrap;
        padding: 6px 10px;
        gap: 6px;
    }
    
    .lctc-chapter-selector-group {
        display: none !important; /* Force hidden on mobile too */
        flex-direction: row;
        align-items: center;
        gap: 4px;
        min-width: auto;
    }
    
    .lctc-chapter-selector-group label {
        font-size: 11px;
        white-space: nowrap;
        margin: 0;
    }
    
    .lctc-chapter-book-select {
        width: auto;
        min-width: 90px;
        max-width: 120px;
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .lctc-chapter-num-select {
        width: auto;
        min-width: 50px;
        max-width: 60px;
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .lctc-chapter-open-btn {
        font-size: 16px;
        padding: 4px 10px;
        min-width: 36px;
    }
    
    .lctc-chapter-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .lctc-chapter-modal-header h2 {
        font-size: 20px;
    }
    
    .lctc-chapter-modal-body {
        padding: 20px;
    }
    
    .lctc-chapter-text {
        padding: 20px;
    }
    
    .lctc-verse-text {
        font-size: 15px;
    }
    
    .lctc-chapter-modal-footer {
        flex-direction: column;
        gap: 12px;
    }
    
    .lctc-chapter-nav-btn {
        width: 100%;
    }
}

/* ===== RTL Support (for Arabic) ===== */
[dir="rtl"] .lctc-verse-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .lctc-chapter-modal-footer {
    flex-direction: row-reverse;
}
