/**
 * Admin Toolbar Styles
 * Floating action button for admin users when browsing the main site
 */

/* ============================================================================
   CSS VARIABLES (matching main site theme)
   ============================================================================ */
:root {
    --toolbar-bg: rgba(24, 39, 75, 0.95);
    --toolbar-bg-solid: #18274b;
    --toolbar-text: #ffffff;
    --toolbar-hover: #7fd1de;
    --toolbar-danger: #dc3545;
    --toolbar-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --toolbar-radius: 12px;
}

[data-theme="dark"] {
    --toolbar-bg: rgba(13, 13, 26, 0.95);
    --toolbar-bg-solid: #0d0d1a;
    --toolbar-text: #e0e0e0;
    --toolbar-hover: #7fd1de;
}

/* Dark mode toggle button - matches unified glassmorphism style */
[data-theme="dark"] .pg-admin-toggle {
    background: rgba(50, 50, 70, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .pg-admin-toggle:hover {
    background: rgba(70, 70, 100, 0.5);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

/* ============================================================================
   MAIN TOOLBAR CONTAINER
   ============================================================================ */
.pg-admin-toolbar {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ============================================================================
   TOGGLE BUTTON (FAB - Floating Action Button)
   Matches Bible lookup button styling for consistency
   ============================================================================ */
.pg-admin-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.pg-admin-toggle:hover {
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.pg-admin-toggle:focus {
    outline: 2px solid rgba(0, 0, 0, 0.2);
    outline-offset: 2px;
}

.pg-admin-toggle:active {
    transform: scale(0.95);
}

/* Rotate icon when expanded */
.pg-admin-toolbar[data-expanded="true"] .pg-admin-toggle {
    transform: rotate(45deg);
}

.pg-admin-toolbar[data-expanded="true"] .pg-admin-toggle:hover {
    transform: rotate(45deg) scale(1.08);
}

/* ============================================================================
   TOOLBAR CONTENT (expandable menu)
   ============================================================================ */
.pg-admin-toolbar-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--toolbar-bg);
    border-radius: var(--toolbar-radius);
    box-shadow: var(--toolbar-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.pg-admin-toolbar[data-expanded="true"] .pg-admin-toolbar-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================================================
   ACTION BUTTONS
   ============================================================================ */
.pg-admin-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--toolbar-text);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
}

.pg-admin-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--toolbar-hover);
    text-decoration: none;
}

.pg-admin-btn:focus {
    outline: 2px solid var(--toolbar-hover);
    outline-offset: -2px;
}

.pg-admin-btn i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Danger button (delete) */
.pg-admin-btn--danger:hover {
    background: rgba(220, 53, 69, 0.25);
    color: #ff6b6b;
}

/* Divider */
.pg-admin-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 4px 0;
}

/* ============================================================================
   KEYBOARD SHORTCUT HINTS
   ============================================================================ */
.pg-admin-shortcut {
    margin-left: auto;
    padding: 2px 6px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-family: monospace;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */
@media (max-width: 576px) {
    .pg-admin-toolbar {
        bottom: 16px;
        right: 16px;
    }

    .pg-admin-toggle {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .pg-admin-toolbar-content {
        padding: 10px;
    }

    .pg-admin-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .pg-admin-shortcut {
        display: none;
    }
}

/* ============================================================================
   ANIMATION FOR FIRST APPEARANCE
   ============================================================================ */
@keyframes toolbar-entrance {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pg-admin-toolbar {
    animation: toolbar-entrance 0.3s ease-out;
}

/* ============================================================================
   ACCESSIBILITY: REDUCE MOTION
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    .pg-admin-toolbar,
    .pg-admin-toggle,
    .pg-admin-toolbar-content,
    .pg-admin-btn {
        transition: none;
        animation: none;
    }
}

/* ============================================================================
   FLOATING STACK OVERRIDES
   When toolbar is inside the unified stack container
   ============================================================================ */
.floating-stack .pg-admin-toolbar {
    position: relative;
    bottom: auto;
    right: auto;
    animation: none; /* Disable entrance animation in stack context */
}

/* Adjust expanded menu position in stack */
.floating-stack .pg-admin-toolbar-content {
    /* Menu appears above the toggle button */
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
}

/* Mobile adjustments within stack */
@media (max-width: 576px) {
    .floating-stack .pg-admin-toolbar {
        /* Position handled by stack container */
    }
}

/* ============================================================================
   TOGGLE BUTTONS (Publish/Unpublish, Pin/Unpin)
   ============================================================================ */
.pg-admin-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* Active state indicator (published/pinned) */
.pg-admin-toggle-btn--active {
    background: rgba(127, 209, 222, 0.12);
}

.pg-admin-toggle-btn--active i {
    color: var(--toolbar-hover);
}

/* Loading state */
.pg-admin-toggle-btn--loading {
    opacity: 0.6;
    pointer-events: none;
}

.pg-admin-toggle-btn--loading i {
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.pg-admin-toast {
    position: fixed;
    bottom: 100px;
    right: 24px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    z-index: 10000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.pg-admin-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.pg-admin-toast--success {
    background: rgba(25, 135, 84, 0.95);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
}

.pg-admin-toast--error {
    background: rgba(220, 53, 69, 0.95);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

[data-theme="dark"] .pg-admin-toast--success {
    background: rgba(25, 135, 84, 0.9);
}

[data-theme="dark"] .pg-admin-toast--error {
    background: rgba(220, 53, 69, 0.9);
}

@media (max-width: 576px) {
    .pg-admin-toast {
        right: 16px;
        bottom: 80px;
    }
}
