/**
 * ================================================================
 * Position-Specific Bookmarks CSS
 * ================================================================
 * Styles for the floating bookmark manager and bookmark indicators
 * WCAG 2.2 AAA Compliant | Mobile Responsive
 * ================================================================
 */

/* ================================================================
   BOOKMARK BUTTON - Floating Action Button
   ================================================================ */

.bookmark-fab {
    position: fixed;
    bottom: 80px;
    right: 30px;
    z-index: 1025;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.bookmark-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.bookmark-fab:active {
    transform: scale(0.95);
}

.bookmark-fab:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 4px;
}

.bookmark-fab.has-bookmarks::after {
    content: attr(data-count);
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #dc2626;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* ================================================================
   BOOKMARK PANEL - Sliding Panel
   ================================================================ */

.bookmark-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background-color: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1030;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bookmark-panel.open {
    right: 0;
}

/* Overlay */
.bookmark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1029;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.bookmark-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Panel Header */
.bookmark-panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #f8f9fa 0%, white 100%);
    flex-shrink: 0;
}

.bookmark-panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bookmark-panel-header .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bookmark-panel-header .close-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.bookmark-panel-header .close-btn:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* Panel Body */
.bookmark-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Empty State */
.bookmark-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: #6b7280;
}

.bookmark-empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.bookmark-empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.bookmark-empty-state p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0;
}

/* ================================================================
   BOOKMARK LIST ITEMS
   ================================================================ */

.bookmark-item {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.bookmark-item:hover {
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
    transform: translateY(-2px);
}

.bookmark-item:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.bookmark-item-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.bookmark-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.bookmark-item-content {
    flex: 1;
    min-width: 0;
}

.bookmark-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-item-note {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0.5rem 0 0 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-item-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 0.25rem 0 0 0;
}

.bookmark-item-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.bookmark-item:hover .bookmark-item-actions {
    opacity: 1;
}

.bookmark-item-actions button {
    background: white;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bookmark-item-actions button:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.bookmark-item-actions button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.bookmark-item-actions button.delete-btn:hover {
    background-color: #fee2e2;
    border-color: #dc2626;
    color: #dc2626;
}

/* ================================================================
   ADD BOOKMARK FORM
   ================================================================ */

.add-bookmark-section {
    padding: 1rem;
    background-color: #f9fafb;
    border-top: 2px solid #e5e7eb;
    flex-shrink: 0;
}

.add-bookmark-form {
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    padding: 1rem;
}

.add-bookmark-form .form-group {
    margin-bottom: 0.75rem;
}

.add-bookmark-form .form-group:last-child {
    margin-bottom: 0;
}

.add-bookmark-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.add-bookmark-form input,
.add-bookmark-form textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.add-bookmark-form input:focus,
.add-bookmark-form textarea:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.add-bookmark-form textarea {
    resize: vertical;
    min-height: 60px;
}

.add-bookmark-form .btn-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.add-bookmark-form button {
    flex: 1;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 40px;
}

.add-bookmark-form button[type="submit"] {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.add-bookmark-form button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.add-bookmark-form button[type="button"] {
    background-color: #f3f4f6;
    color: #6b7280;
}

.add-bookmark-form button[type="button"]:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.add-bookmark-form button:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* ================================================================
   BOOKMARK INDICATORS - On-page markers
   ================================================================ */

.bookmark-indicator {
    position: absolute;
    left: -40px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    transition: all 0.2s;
    z-index: 10;
}

.bookmark-indicator:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.6);
}

.bookmark-indicator:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* ================================================================
   RESPONSIVE - Mobile Optimizations
   ================================================================ */

@media (max-width: 767.98px) {
    .bookmark-panel {
        width: 100%;
        max-width: 100vw;
        right: -100%;
    }
    
    .bookmark-fab {
        bottom: 70px;
        right: 20px;
        width: 52px;
        height: 52px;
    }
    
    .bookmark-toast {
        bottom: 12rem;
        right: 1.25rem;
    }
    
    .bookmark-item-actions {
        opacity: 1;
        position: static;
        margin-top: 0.75rem;
        justify-content: flex-end;
    }
    
    .add-bookmark-form .btn-group {
        flex-direction: column;
    }
    
    .add-bookmark-form button {
        width: 100%;
    }
}

/* ================================================================
   ACCESSIBILITY ENHANCEMENTS
   ================================================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bookmark-fab,
    .bookmark-item-icon {
        border: 2px solid currentColor;
    }
    
    .bookmark-item {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bookmark-panel,
    .bookmark-overlay,
    .bookmark-fab,
    .bookmark-item {
        transition: none;
    }
}

/* Print styles - Hide bookmark UI */
@media print {
    .bookmark-fab,
    .bookmark-panel,
    .bookmark-overlay,
    .bookmark-indicator {
        display: none !important;
    }
}

/* ================================================================
   LOADING STATE
   ================================================================ */

.bookmark-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.bookmark-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ================================================================
   SUCCESS/ERROR TOAST NOTIFICATIONS
   ================================================================ */

.bookmark-toast {
    position: fixed;
    bottom: 14rem;
    right: 1.875rem;
    background-color: white;
    color: #1f2937;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 350px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.bookmark-toast.success {
    border-left: 4px solid #16a34a;
}

.bookmark-toast.error {
    border-left: 4px solid #dc2626;
}

.bookmark-toast i {
    font-size: 1.25rem;
}

.bookmark-toast.success i {
    color: #16a34a;
}

.bookmark-toast.error i {
    color: #dc2626;
}

.bookmark-toast-message {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* ================================================================
   END OF BOOKMARK STYLES
   ================================================================ */
