/**
 * Floating Watchlist Widget Styles
 */

/* Floating Button */
.floating-watchlist-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
/*    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    background-color: #198754;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 1002; /* Higher than panel and overlay to ensure it's always clickable */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    pointer-events: auto; /* Always allow clicks */
}

.floating-watchlist-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.floating-watchlist-btn.active {
/*    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);*/
    background-color: #198754;
}

.floating-watchlist-btn .watchlist-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-watchlist-btn .watchlist-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Slide-in Panel */
.floating-watchlist-panel {
    position: fixed;
    left: -400px;
    bottom: 90px; /* Position above the floating button (60px height + 20px bottom + 10px gap) */
    width: 380px;
    max-height: calc(100vh - 100px); /* Leave space for button */
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1001; /* Above the button */
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px 0 0 8px;
    pointer-events: none; /* Prevent blocking clicks when closed */
}

.floating-watchlist-panel.open {
    left: 0;
    pointer-events: auto; /* Allow clicks when open */
}

/* Panel Header */
.watchlist-panel-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.watchlist-panel-header h5 {
    color: white;
    margin: 0;
    font-size: 1.1rem;
}

.watchlist-panel-header .btn-close {
    filter: invert(1);
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 10px;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: white;
    font-weight: bold;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.watchlist-panel-header .btn-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Panel Body */
.watchlist-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.watchlist-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.watchlist-item {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.watchlist-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.watchlist-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.watchlist-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

.watchlist-item-title:hover {
    color: #667eea;
    text-decoration: underline;
}

/* Panel Footer */
.watchlist-panel-footer {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .floating-watchlist-panel {
        width: 100%;
        left: -100%;
        top: 70px; /* Start below the sticky navbar */
        bottom: 85px; /* Adjust for smaller button */
        max-height: calc(100vh - 145px); /* Account for navbar (60px) + button space (85px) */
        pointer-events: none; /* Prevent blocking clicks when closed on mobile */
    }
    
    .floating-watchlist-panel.open {
        left: 0;
        pointer-events: auto; /* Allow clicks when open on mobile */
    }
    
    .floating-watchlist-btn {
        bottom: 15px;
        left: 15px;
        width: 55px;
        height: 55px;
    }
}

/* Overlay for mobile */
.watchlist-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000; /* Behind panel (1001) and button (1002) but above page content */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Don't block clicks when hidden */
    display: none; /* Hidden by default on desktop */
}

.watchlist-overlay.active {
    opacity: 1;
    pointer-events: auto; /* Allow clicks when visible (to close panel) */
}

@media (max-width: 768px) {
    .watchlist-overlay {
        display: block; /* Show on mobile */
    }
}

