/**
 * Holy Bible by GoBible - Styles
 * 
 * Estilos para links de referências bíblicas e tooltips
 * 
 * @package Holy_Bible_by_GoBible
 * @version 1.0.0
 */

/* ===========================
   Base Link Styles
   =========================== */

.hbgb-link {
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.hbgb-link:hover {
    opacity: 0.85;
}

.hbgb-link:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ===========================
   Tooltip Container
   =========================== */

.hbgb-tooltip {
    position: absolute;
    z-index: 999999;
    max-width: 380px;
    min-width: 280px;
    padding: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333333;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.hbgb-tooltip.hbgb-tooltip--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.hbgb-tooltip.hbgb-tooltip--above {
    transform: translateY(-8px);
}

.hbgb-tooltip.hbgb-tooltip--above.hbgb-tooltip--visible {
    transform: translateY(0);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .hbgb-tooltip {
        background: #1e1e1e;
        color: #e0e0e0;
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
    }
}

/* WordPress Dark Mode (via body class) */
body.dark-mode .hbgb-tooltip,
body.theme-dark .hbgb-tooltip,
.wp-dark-mode .hbgb-tooltip {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.1);
}

/* ===========================
   Tooltip Header
   =========================== */

.hbgb-tooltip__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%);
    border-radius: 11px 11px 0 0;
    color: #ffffff;
}

.hbgb-tooltip__logo {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.9;
}

.hbgb-tooltip__reference {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.02em;
    flex: 1;
}

.hbgb-tooltip__version-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.hbgb-tooltip__version-link:hover {
    opacity: 0.8;
}

.hbgb-tooltip__version {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
}

/* ===========================
   Tooltip Content
   =========================== */

.hbgb-tooltip__content {
    padding: 16px;
}

.hbgb-tooltip__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: inherit;
}

.hbgb-tooltip__text em,
.hbgb-tooltip__text i {
    font-style: italic;
}

/* Verse Numbers (when showing multiple verses) */
.hbgb-tooltip__verse-number {
    font-weight: 700;
    font-size: 11px;
    color: #1a365d;
    margin-right: 4px;
    vertical-align: super;
}

@media (prefers-color-scheme: dark) {
    .hbgb-tooltip__verse-number {
        color: #90cdf4;
    }
}

body.dark-mode .hbgb-tooltip__verse-number,
body.theme-dark .hbgb-tooltip__verse-number,
.wp-dark-mode .hbgb-tooltip__verse-number {
    color: #90cdf4;
}

/* ===========================
   Tooltip Footer
   =========================== */

.hbgb-tooltip__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 0 11px 11px;
}

@media (prefers-color-scheme: dark) {
    .hbgb-tooltip__footer {
        border-top-color: rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.03);
    }
}

body.dark-mode .hbgb-tooltip__footer,
body.theme-dark .hbgb-tooltip__footer,
.wp-dark-mode .hbgb-tooltip__footer {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.hbgb-tooltip__read-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #1a365d;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hbgb-tooltip__read-more:hover {
    color: #2b6cb0;
    text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
    .hbgb-tooltip__read-more {
        color: #90cdf4;
    }
    
    .hbgb-tooltip__read-more:hover {
        color: #63b3ed;
    }
}

body.dark-mode .hbgb-tooltip__read-more,
body.theme-dark .hbgb-tooltip__read-more,
.wp-dark-mode .hbgb-tooltip__read-more {
    color: #90cdf4;
}

.hbgb-tooltip__read-more-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
}

/* ===========================
   Loading State
   =========================== */

.hbgb-tooltip--loading .hbgb-tooltip__content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.hbgb-tooltip__loader {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(26, 54, 93, 0.15);
    border-top-color: #1a365d;
    border-radius: 50%;
    animation: hbgb-spin 0.8s linear infinite;
}

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

@media (prefers-color-scheme: dark) {
    .hbgb-tooltip__loader {
        border-color: rgba(144, 205, 244, 0.2);
        border-top-color: #90cdf4;
    }
}

body.dark-mode .hbgb-tooltip__loader,
body.theme-dark .hbgb-tooltip__loader,
.wp-dark-mode .hbgb-tooltip__loader {
    border-color: rgba(144, 205, 244, 0.2);
    border-top-color: #90cdf4;
}

/* ===========================
   Error State
   =========================== */

.hbgb-tooltip--error .hbgb-tooltip__content {
    text-align: center;
    color: #e53e3e;
}

.hbgb-tooltip__error-icon {
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    fill: #e53e3e;
}

.hbgb-tooltip__error-message {
    font-size: 13px;
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    .hbgb-tooltip--error .hbgb-tooltip__content {
        color: #fc8181;
    }
    
    .hbgb-tooltip__error-icon {
        fill: #fc8181;
    }
}

/* ===========================
   Arrow/Pointer
   =========================== */

.hbgb-tooltip::before {
    content: '';
    position: absolute;
    left: 20px;
    width: 12px;
    height: 12px;
    background: inherit;
    border: inherit;
    border-right: none;
    border-bottom: none;
    transform: rotate(45deg);
}

.hbgb-tooltip--below::before {
    top: -7px;
}

.hbgb-tooltip--above::before {
    bottom: -7px;
    transform: rotate(-135deg);
}

/* ===========================
   Accessibility
   =========================== */

.hbgb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .hbgb-tooltip {
        transition: none;
    }
    
    .hbgb-tooltip__loader {
        animation: none;
    }
    
    .hbgb-link {
        transition: none;
    }
}

/* ===========================
   Responsive
   =========================== */

@media screen and (max-width: 480px) {
    .hbgb-tooltip {
        max-width: calc(100vw - 32px);
        min-width: 260px;
    }
    
    .hbgb-tooltip__header {
        padding: 10px 14px;
    }
    
    .hbgb-tooltip__content {
        padding: 14px;
    }
    
    .hbgb-tooltip__text {
        font-size: 13px;
    }
}

/* ===========================
   Print Styles
   =========================== */

@media print {
    .hbgb-tooltip {
        display: none !important;
    }
    
    .hbgb-link {
        color: inherit !important;
        text-decoration: underline !important;
    }
    
    .hbgb-link::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        font-style: italic;
    }
}
