/**
 * Gill Commentary Styles
 *
 * Styles for displaying John Gill's Exposition of the Bible
 * in the Bible lookup modal.
 *
 * @package PristineGrace
 * @since 4.4
 */

/* ==========================================================================
   GILL COMMENTARY CONTAINER
   ========================================================================== */

.gill-commentary-section {
    margin-top: 1.5rem;
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
}

.gill-commentary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.gill-commentary-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gill-commentary-title i {
    color: #6c757d;
}

button.gill-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #395ba9;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #395ba9;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: normal;
}

button.gill-toggle-btn:hover {
    background: #395ba9;
    color: white;
}

button.gill-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(57, 91, 169, 0.25);
}

button.gill-toggle-btn.active {
    background: #395ba9;
    color: white;
}

button.gill-toggle-btn.active:hover {
    background: #2e4a8a;
    border-color: #2e4a8a;
}

button.gill-toggle-btn i {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

button.gill-toggle-btn.active i {
    transform: rotate(180deg);
}

#gillCommentaryContent,
.gill-commentary-content {
    display: none !important;
    padding: 1rem;
    background: #fdfcfa;
    border: 1px solid #e9e5df;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #333;
    margin-top: 0.75rem;
}

#gillCommentaryContent.show,
.gill-commentary-content.show {
    display: block !important;
}

/* Loading state */
.gill-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

.gill-loading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.75rem;
}

/* Error state */
.gill-error {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    font-size: 0.9rem;
}

/* Info state (no commentary available) */
.gill-info {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    color: #6c757d;
    font-size: 0.9rem;
    font-style: italic;
}

/* ==========================================================================
   MULTI-VERSE COMMENTARY DISPLAY
   ========================================================================== */

.gill-verse-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    background: #f1f3f4;
    padding: 0.4rem 0.75rem;
    margin: 1rem -1rem 0.75rem -1rem;
    border-top: 1px solid #e9e5df;
    border-bottom: 1px solid #e9e5df;
}

.gill-verse-header:first-child {
    margin-top: 0;
    border-top: none;
}

.gill-verse-content {
    margin-bottom: 1rem;
}

.gill-verse-content:last-child {
    margin-bottom: 0;
}

.gill-verse-content.gill-no-content {
    color: #6c757d;
    font-style: italic;
    padding: 0.5rem 0;
}

.gill-chapter-divider {
    margin: 1.5rem 0;
    border-top: 2px solid #dee2e6;
}

/* ==========================================================================
   COMMENTARY TEXT ELEMENTS
   ========================================================================== */

/* Paragraphs */
.gill-para {
    margin-bottom: 1em;
    text-align: justify;
}

.gill-para:first-child {
    margin-top: 0;
}

.gill-para:last-child {
    margin-bottom: 0;
}

/* Scripture quotations - styled distinctly */
.gill-scripture {
    color: #1a4a7a;
    font-weight: 500;
}

/* Hebrew text */
.gill-hebrew {
    font-family: "SBL Hebrew", "Ezra SIL", "Times New Roman", serif;
    direction: rtl;
    unicode-bidi: isolate;
    font-size: 1.1em;
    color: #5c4033;
    background: #f9f7f4;
    padding: 0 0.25em;
    border-radius: 2px;
}

/* Show transliteration after Hebrew */
.gill-hebrew::after {
    content: " (" attr(data-translit) ")";
    direction: ltr;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 0.85em;
    color: #777;
}

/* Greek text */
.gill-greek {
    font-family: "SBL Greek", "Gentium Plus", "Times New Roman", serif;
    font-style: italic;
    color: #5c4033;
    background: #f9f7f4;
    padding: 0 0.25em;
    border-radius: 2px;
}

/* Show transliteration after Greek */
.gill-greek::after {
    content: " (" attr(data-translit) ")";
    font-style: normal;
    font-size: 0.85em;
    color: #777;
}

/* Bible reference links */
.gill-ref {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px dotted #0066cc;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gill-ref:hover {
    color: #004499;
    border-bottom-style: solid;
}

/* Cross-reference links (See commentary on...) */
.gill-crossref {
    color: #6c757d;
    text-decoration: none;
    font-style: italic;
    font-size: 0.9em;
    cursor: pointer;
    transition: color 0.15s ease;
}

.gill-crossref:hover {
    color: #495057;
    text-decoration: underline;
}

/* Footnote markers */
.gill-footnote {
    font-size: 0.8em;
    vertical-align: super;
    color: #6c757d;
    font-weight: 500;
}

/* Block quotes (Targum, etc.) */
.gill-quote {
    margin: 1em 1.5em;
    padding: 0.75em 1em;
    border-left: 3px solid #c9a959;
    background: #fdfbf5;
    font-style: italic;
    color: #555;
}

.gill-quote::before {
    content: none;
}

/* ==========================================================================
   CROSS-REFERENCE INDICATOR
   ========================================================================== */

.gill-crossref-notice {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    background: #f0f7ff;
    border: 1px solid #b8daff;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.gill-crossref-notice i {
    color: #0066cc;
    margin-right: 0.5rem;
    margin-top: 0.15rem;
}

.gill-crossref-notice .gill-crossref-link {
    color: #0066cc;
    text-decoration: underline;
    cursor: pointer;
}

.gill-crossref-notice .gill-crossref-link:hover {
    color: #004499;
}

/* ==========================================================================
   SEARCH RESULTS
   ========================================================================== */

.gill-search-results {
    margin-top: 1rem;
}

.gill-search-result {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.15s ease;
}

.gill-search-result:hover {
    background: #f8f9fa;
}

.gill-search-result:last-child {
    border-bottom: none;
}

.gill-search-result-ref {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.gill-search-result-snippet {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

.gill-search-result-snippet mark {
    background: #fff3cd;
    padding: 0 0.15em;
    border-radius: 2px;
}

/* ==========================================================================
   SEARCH TAB ADDITION
   ========================================================================== */

.gill-search-tab {
    display: none;
    padding: 1rem;
}

.gill-search-tab.active {
    display: block;
}

.gill-search-input-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
}

.gill-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95rem;
}

.gill-search-input:focus {
    border-color: #80bdff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 768px) {
    .gill-commentary-content {
        max-height: 300px;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .gill-quote {
        margin: 0.75em 0.5em;
        padding: 0.5em 0.75em;
    }

    .gill-hebrew::after,
    .gill-greek::after {
        display: block;
        margin-top: 0.25em;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .gill-commentary-content {
        max-height: none;
        overflow: visible;
        border: none;
        background: white;
    }

    .gill-toggle-btn {
        display: none;
    }

    .gill-ref,
    .gill-crossref {
        color: inherit;
        border: none;
        text-decoration: none;
    }

    .gill-hebrew::after,
    .gill-greek::after {
        color: #666;
    }
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */

[data-theme="dark"] .gill-commentary-section {
    border-top-color: #3d4450;
}

[data-theme="dark"] .gill-commentary-title {
    color: #c8ccd0;
}

[data-theme="dark"] .gill-commentary-title i {
    color: #8a9199;
}

[data-theme="dark"] button.gill-toggle-btn {
    background: #252530;
    border-color: #7fa8e8;
    color: #7fa8e8;
}

[data-theme="dark"] button.gill-toggle-btn:hover {
    background: #2a4080;
    border-color: #2a4080;
    color: white;
}

[data-theme="dark"] button.gill-toggle-btn.active {
    background: #2a4080;
    border-color: #2a4080;
    color: white;
}

[data-theme="dark"] button.gill-toggle-btn.active:hover {
    background: #335099;
    border-color: #335099;
}

[data-theme="dark"] #gillCommentaryContent,
[data-theme="dark"] .gill-commentary-content {
    background: #1e2328;
    border-color: #3d4450;
    color: #c8ccd0;
}

[data-theme="dark"] .gill-loading {
    color: #8a9199;
}

[data-theme="dark"] .gill-error {
    background: #3b2020;
    border-color: #5c3333;
    color: #f5a5a5;
}

[data-theme="dark"] .gill-info {
    background: #252a30;
    border-color: #3d4450;
    color: #8a9199;
}

/* Commentary text elements - dark mode */
[data-theme="dark"] .gill-scripture {
    color: #6db3f2;
}

[data-theme="dark"] .gill-hebrew {
    color: #d4a574;
    background: #2a2520;
}

[data-theme="dark"] .gill-hebrew::after {
    color: #8a9199;
}

[data-theme="dark"] .gill-greek {
    color: #d4a574;
    background: #2a2520;
}

[data-theme="dark"] .gill-greek::after {
    color: #8a9199;
}

[data-theme="dark"] .gill-ref {
    color: #6db3f2;
    border-bottom-color: #6db3f2;
}

[data-theme="dark"] .gill-ref:hover {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
}

[data-theme="dark"] .gill-crossref {
    color: #8a9199;
}

[data-theme="dark"] .gill-crossref:hover {
    color: #c8ccd0;
}

[data-theme="dark"] .gill-footnote {
    color: #8a9199;
}

[data-theme="dark"] .gill-quote {
    background: #252218;
    border-left-color: #b8942e;
    color: #b0b5bb;
}

[data-theme="dark"] .gill-crossref-notice {
    background: #1a2533;
    border-color: #2d4a6d;
}

[data-theme="dark"] .gill-crossref-notice i {
    color: #6db3f2;
}

[data-theme="dark"] .gill-crossref-notice .gill-crossref-link {
    color: #6db3f2;
}

[data-theme="dark"] .gill-crossref-notice .gill-crossref-link:hover {
    color: #93c5fd;
}

/* Search results - dark mode */
[data-theme="dark"] .gill-search-result {
    border-bottom-color: #3d4450;
}

[data-theme="dark"] .gill-search-result:hover {
    background: #252a30;
}

[data-theme="dark"] .gill-search-result-ref {
    color: #c8ccd0;
}

[data-theme="dark"] .gill-search-result-snippet {
    color: #8a9199;
}

[data-theme="dark"] .gill-search-result-snippet mark {
    background: #5c4d1a;
    color: #f5e6a3;
}

[data-theme="dark"] .gill-search-input {
    background: #1e2328;
    border-color: #3d4450;
    color: #c8ccd0;
}

[data-theme="dark"] .gill-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

/* Multi-verse display - dark mode */
[data-theme="dark"] .gill-verse-header {
    color: #c8ccd0;
    background: #252a30;
    border-top-color: #3d4450;
    border-bottom-color: #3d4450;
}

[data-theme="dark"] .gill-verse-content.gill-no-content {
    color: #8a9199;
}

[data-theme="dark"] .gill-chapter-divider {
    border-top-color: #4b5563;
}

/* ==========================================================================
   GILL COMMENTARY IN-CONTENT SEARCH
   ========================================================================== */

.gill-search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.gill-search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.gill-search-icon {
    position: absolute;
    left: 0.75rem;
    color: #6c757d;
    font-size: 0.875rem;
    pointer-events: none;
}

.gill-search-bar .gill-search-input {
    width: 100%;
    padding: 0.4rem 0.75rem 0.4rem 2rem;
    font-size: 16px; /* Prevent iOS zoom */
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
}

.gill-search-bar .gill-search-input:focus {
    outline: none;
    border-color: #395ba9;
    box-shadow: 0 0 0 2px rgba(57, 91, 169, 0.1);
}

.gill-search-bar .gill-search-input::placeholder {
    color: #adb5bd;
}

.gill-search-clear {
    position: absolute;
    right: 0.5rem;
    padding: 0.25rem;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    font-size: 1rem;
}

.gill-search-clear:hover {
    color: #495057;
}

.gill-search-bar .gill-search-results {
    font-size: 0.8rem;
    color: #6c757d;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.gill-search-nav {
    display: flex;
    gap: 0.25rem;
}

.gill-search-nav-btn {
    padding: 0.25rem 0.5rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
}

.gill-search-nav-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

/* Search highlight styling */
.gill-search-highlight {
    background: #fff3cd;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

.gill-search-highlight.current {
    background: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.5);
}

/* Dark mode - in-content search */
[data-theme="dark"] .gill-search-bar {
    background: #252a30;
    border-color: #3d4450;
}

[data-theme="dark"] .gill-search-bar .gill-search-input {
    background: #1e2328;
    border-color: #3d4450;
    color: #c8ccd0;
}

[data-theme="dark"] .gill-search-bar .gill-search-input:focus {
    border-color: #7fa8e8;
    box-shadow: 0 0 0 2px rgba(127, 168, 232, 0.15);
}

[data-theme="dark"] .gill-search-bar .gill-search-input::placeholder {
    color: #6c757d;
}

[data-theme="dark"] .gill-search-icon {
    color: #8a9199;
}

[data-theme="dark"] .gill-search-clear {
    color: #8a9199;
}

[data-theme="dark"] .gill-search-clear:hover {
    color: #c8ccd0;
}

[data-theme="dark"] .gill-search-bar .gill-search-results {
    color: #8a9199;
}

[data-theme="dark"] .gill-search-nav-btn {
    background: #1e2328;
    border-color: #3d4450;
    color: #c8ccd0;
}

[data-theme="dark"] .gill-search-nav-btn:hover {
    background: #2d333b;
    border-color: #4b5563;
}

[data-theme="dark"] .gill-search-highlight {
    background: rgba(255, 193, 7, 0.3);
    color: #e8e0c8;
}

[data-theme="dark"] .gill-search-highlight.current {
    background: rgba(255, 193, 7, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

/* Dark mode scrollbar for Gill commentary content */
[data-theme="dark"] #gillCommentaryContent {
    scrollbar-color: #555 #2a2a35;
}

[data-theme="dark"] #gillCommentaryContent::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] #gillCommentaryContent::-webkit-scrollbar-track {
    background: #2a2a35;
    border-radius: 4px;
}

[data-theme="dark"] #gillCommentaryContent::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

[data-theme="dark"] #gillCommentaryContent::-webkit-scrollbar-thumb:hover {
    background: #777;
}
