/**
 * EW Chapter Nav - Styles
 * Navigation arrows for Bible commentary chapter navigation
 * Uses ID specificity to override theme conflicts
 *
 * Two styles:
 *   .ew-chapter-nav-style-subtle  — semi-transparent white pill (default)
 *   .ew-chapter-nav-style-button  — EW Blue circle, matches Bible Reader handle
 *
 * --ew-cn-opacity is set via JS from admin settings.
 */

/* === Fade-in animation === */
@keyframes ewChapterNavFadeIn {
    0% { opacity: 0; }
    100% { opacity: var(--ew-cn-opacity, 0.5); }
}

/* === Shared base: both styles === */
#ew-chapter-nav-prev,
#ew-chapter-nav-next {
    position: fixed;
    top: 67%;
    transform: translateY(-50%);
    z-index: 9999; /* Below selectors (10000), drawer (10100), tooltip (10200) */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    text-decoration: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 13px;
    line-height: 1;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    animation: ewChapterNavFadeIn 0.3s ease 0.5s forwards;
}

#ew-chapter-nav-prev {
    left: 8px;
}

#ew-chapter-nav-next {
    right: 8px;
}

#ew-chapter-nav-prev:hover,
#ew-chapter-nav-next:hover {
    opacity: 1 !important;
    text-decoration: none;
}

/* ============================
   SUBTLE STYLE (default)
   ============================ */
#ew-chapter-nav-prev.ew-chapter-nav-style-subtle,
#ew-chapter-nav-next.ew-chapter-nav-style-subtle {
    padding: 12px 10px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(200, 200, 200, 0.3);
    border-radius: 24px;
    color: #555;
}

#ew-chapter-nav-prev.ew-chapter-nav-style-subtle:hover,
#ew-chapter-nav-next.ew-chapter-nav-style-subtle:hover {
    background: #ffffff;
    border-color: #449ae3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    color: #449ae3;
}

.ew-chapter-nav-style-subtle .ew-chapter-nav-chevron {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-style: solid;
    border-color: #555;
    transition: border-color 0.2s ease;
}

#ew-chapter-nav-prev.ew-chapter-nav-style-subtle:hover .ew-chapter-nav-chevron,
#ew-chapter-nav-next.ew-chapter-nav-style-subtle:hover .ew-chapter-nav-chevron {
    border-color: #449ae3;
}

/* ============================
   BUTTON STYLE (Bible Reader)
   Resting: blue circle, white chevron
   Hover: expands to white pill, blue border, blue text + chevron, label visible
   ============================ */
#ew-chapter-nav-prev.ew-chapter-nav-style-button,
#ew-chapter-nav-next.ew-chapter-nav-style-button {
    width: 44px;
    height: 44px;
    padding: 0 12px;
    background: #449ae3;
    border: 2px solid #449ae3;
    border-radius: 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    color: #ffffff;
    overflow: hidden;
    transition: opacity 0.2s ease, background 0.25s ease, border-color 0.25s ease,
                box-shadow 0.25s ease, width 0.3s ease, border-radius 0.25s ease, color 0.25s ease;
}

#ew-chapter-nav-prev.ew-chapter-nav-style-button:hover,
#ew-chapter-nav-next.ew-chapter-nav-style-button:hover {
    width: auto;
    background: #ffffff;
    border-color: #449ae3;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
    color: #449ae3;
    border-radius: 24px;
    padding: 0 16px;
}

.ew-chapter-nav-style-button .ew-chapter-nav-chevron {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-style: solid;
    border-color: #ffffff;
    transition: border-color 0.25s ease;
    flex-shrink: 0;
}

#ew-chapter-nav-prev.ew-chapter-nav-style-button:hover .ew-chapter-nav-chevron,
#ew-chapter-nav-next.ew-chapter-nav-style-button:hover .ew-chapter-nav-chevron {
    border-color: #449ae3;
}

/* Button style: label hidden at rest, revealed on hover */
.ew-chapter-nav-style-button .ew-chapter-nav-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    margin: 0;
    color: #449ae3;
    font-size: 14px;
    font-weight: 500;
    transition: max-width 0.3s ease, opacity 0.2s ease 0.05s, margin 0.3s ease;
}

#ew-chapter-nav-prev.ew-chapter-nav-style-button:hover .ew-chapter-nav-label {
    max-width: 200px;
    opacity: 1;
    margin-left: 8px;
}

#ew-chapter-nav-next.ew-chapter-nav-style-button:hover .ew-chapter-nav-label {
    max-width: 200px;
    opacity: 1;
    margin-right: 8px;
}

/* ============================
   CHEVRON DIRECTIONS (shared)
   ============================ */
.ew-chapter-nav-chevron-left {
    border-width: 0 0 2px 2px;
    transform: rotate(45deg);
}

.ew-chapter-nav-chevron-right {
    border-width: 2px 2px 0 0;
    transform: rotate(45deg);
}

/* ============================
   HOVER LABEL (subtle only)
   ============================ */
.ew-chapter-nav-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    margin: 0;
}

#ew-chapter-nav-prev.ew-chapter-nav-style-subtle:hover .ew-chapter-nav-label {
    max-width: 200px;
    opacity: 1;
    margin-left: 6px;
}

#ew-chapter-nav-next.ew-chapter-nav-style-subtle:hover .ew-chapter-nav-label {
    max-width: 200px;
    opacity: 1;
    margin-right: 6px;
}

/* ============================
   BIBLE READER DRAWER HIDE
   ============================ */
#ew-br-container.ew-br-open ~ #ew-chapter-nav-next {
    display: none;
}

/* ============================
   MOBILE — keep side arrows, just slightly smaller
   ============================ */
@media (max-width: 600px) {
    #ew-chapter-nav-prev.ew-chapter-nav-style-button,
    #ew-chapter-nav-next.ew-chapter-nav-style-button {
        width: 36px;
        height: 36px;
    }

    #ew-chapter-nav-prev.ew-chapter-nav-style-subtle,
    #ew-chapter-nav-next.ew-chapter-nav-style-subtle {
        padding: 10px 8px;
    }
}
