/* Pastor's Study Bible - Reusable Components */

/* PASSWORD TOGGLE */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    flex: 1;
    padding-right: 2.5rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    line-height: 1;
}

.password-toggle-btn:hover {
    color: var(--text-primary);
}

.password-toggle-btn svg {
    width: 1.1rem;
    height: 1.1rem;
    pointer-events: none;
}

/* BUTTON STYLES */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-medium);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-size: 0.95rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-light);
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

.btn-danger-outline:hover {
    background: var(--danger-color);
    color: white;
    transform: translateY(-1px);
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0.25rem var(--spacing-sm);
    text-decoration: underline;
    font-size: 0.9rem;
}

.btn-link:hover {
    color: var(--primary-hover);
    background: rgba(52, 152, 219, 0.1);
}

.btn-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* AUTH BUTTONS */
.auth-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.auth-btn {
    padding: 0.4rem 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
}

.auth-btn:hover {
    background: var(--primary-hover);
}

.auth-btn-compact {
    padding: 0.3rem 0.6rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

.auth-btn-compact:hover {
    background: var(--primary-hover);
}

/* ACTION BUTTONS */
.smart-search-container {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.action-btn {
    padding: 0.4rem 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.action-btn.secondary {
    background: var(--text-secondary);
}

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

.action-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.search-action-btn {
    padding: 0.4rem 0.6rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.search-action-btn:hover {
    transform: translateY(-1px);
}

/* TOGGLE BUTTONS */
.toggle-btn {
    padding: 0.3rem 0.6rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.75rem;
}

.toggle-btn.inactive {
    background: var(--text-secondary);
}

.toggle-notes-btn {
    padding: 0.3rem 0.6rem;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8rem;
}

.toggle-notes-btn:hover {
    background: #5a6268;
}

/* CONTROLS */
.controls {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

/* FORM STYLES */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: bold;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius-medium);
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* SEARCH STYLES */
.search-inline {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-dark);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    min-width: 150px;
    max-width: 300px;
    width: 100%;
    transition: var(--transition-fast);
}

.search-inline:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.search-inline::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-dark);
    border-radius: var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
    display: none;
    box-shadow: var(--shadow-large);
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    justify-content: space-between;
    transition: var(--transition-fast);
}

.suggestion-item:hover {
    background: var(--bg-light);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-text {
    font-weight: 500;
}

.suggestion-meta {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* TOOLBAR */
.toolbar {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-light);
    border: 1px solid var(--border-dark);
    border-radius: var(--border-radius);
}

.toolbar button {
    padding: 0.3rem 0.6rem;
    background: var(--bg-white);
    border: 1px solid var(--border-dark);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.toolbar button:hover {
    background: var(--bg-secondary);
}

.toolbar button.active {
    background: var(--primary-color);
    color: white;
}

/* NAVIGATION BUTTONS */
.nav-btn-compact {
    padding: 0.4rem 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.nav-btn-compact:hover {
    background: var(--primary-hover);
}

.nav-btn-compact:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* BACK BUTTON */
.back-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--info-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: var(--spacing-md);
}

.back-btn:hover {
    background: var(--info-hover);
}

.back-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

/* FILTER BUTTONS */
.filter-btn {
    padding: 0.3rem 0.6rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    cursor: pointer;
}

.filter-btn.inactive {
    background: var(--text-secondary);
}

/* SCRIPTURE TOOLTIPS - Clean card-based design inspired by Logos RefTagger */
.scripture-link {
    position: relative;
    cursor: pointer;
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--primary-color);
    font-weight: 500;
}

.scripture-link:hover {
    color: var(--primary-hover);
}

/* Desktop hover tooltips */
@media (hover: hover) and (pointer: fine) {
    .scripture-link[data-tooltip-loaded]:hover::before {
        content: attr(data-tooltip-ref) "\A" attr(data-tooltip-text);
        position: fixed;
        top: var(--tooltip-top, -999px);
        left: 50%;
        transform: translateX(-50%);
        padding: 0.65rem 0.9rem;
        background: white;
        border: 1px solid #d0d7de;
        border-radius: 6px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
        width: max-content;
        max-width: 400px;
        min-width: 240px;
        z-index: var(--z-tooltip);
        pointer-events: none;
        animation: tooltipFadeIn 0.2s ease-out;
        white-space: pre-wrap;
        font-size: 0.875rem;
        line-height: 1.65;
        color: var(--text-primary);
        text-align: left;
        font-weight: 400;
    }

    /* Arrow pointing up toward the link above the tooltip */
    .scripture-link[data-tooltip-loaded]:hover::after {
        content: '';
        position: fixed;
        top: calc(var(--tooltip-top, -999px) - 14px);
        left: 50%;
        transform: translateX(-50%);
        border: 7px solid transparent;
        border-bottom-color: white;
        z-index: var(--z-tooltip);
        pointer-events: none;
        filter: drop-shadow(0 -1px 2px rgba(0, 0, 0, 0.15));
    }
}

/* Mobile tap tooltips */
@media (hover: none) and (pointer: coarse) {
    .scripture-link.show-mobile-tooltip::before {
        content: attr(data-tooltip-ref) "\A" attr(data-tooltip-text) "\A\A" "→ Tap again to navigate";
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 12px;
        padding: 0.75rem 1rem;
        background:
            linear-gradient(to bottom,
                #f0f4f8 0%,
                #f0f4f8 2rem,
                white 2rem,
                white 100%
            );
        border: 1px solid #d0d7de;
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        white-space: pre-wrap;
        max-width: 90vw;
        width: max-content;
        min-width: 240px;
        z-index: var(--z-tooltip);
        pointer-events: none;
        animation: tooltipSlideIn 0.25s ease-out;
        text-align: left;
        font-size: 0.875rem;
        line-height: 1.6;
        color: var(--text-primary);
        font-weight: 400;
    }

    .scripture-link.show-mobile-tooltip::after {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 5px;
        border: 8px solid transparent;
        border-top-color: white;
        z-index: var(--z-tooltip);
        pointer-events: none;
        filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
    }
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}