/* ========================================
   MODERN RECENT OFFERS FAB & POPOVER
   ======================================== */

.recent-searches-fab-container {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 9000;
}

.recent-searches-fab {
    background-color: #111827; /* Dark slate */
    color: white;
    border: none;
    border-radius: 50%; /* Circle */
    width: 80px;
    height: 80px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
}

.recent-searches-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background-color: #1f2937;
}

.recent-searches-fab:active {
    transform: translateY(0) scale(0.95);
}

.fab-main-icon {
    font-size: 1.8rem;
    z-index: 2;
}

.circular-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: spin-text 25s linear infinite;
    z-index: 1;
}

.circular-text text {
    font-size: 11px;
    font-weight: 600;
    fill: white;
    letter-spacing: 4px;
}

@keyframes spin-text {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fab-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background-color: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* The Popover Modal */
.recent-searches-popover {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 0;
    width: 340px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.recent-searches-popover.show {
    display: flex;
    animation: popoverFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes popoverFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.95) translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.rs-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.rs-popover-title {
    font-weight: 800;
    color: #1e293b;
    font-size: 1.15rem;
}

.rs-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s ease;
}

.rs-close-btn:hover {
    color: #475569;
}

.rs-popover-body {
    padding: 16px;
    max-height: 380px;
    overflow-y: auto;
}

.rs-empty-msg {
    text-align: center;
    color: #94a3b8;
    padding: 30px 10px;
    font-size: 0.95rem;
}

/* Grid for the items inside the popover */
.rs-items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    justify-items: center;
}

/* Single offer item - modern pill design */
.recent-offer-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 64px;
    height: 64px;
    margin: 0 auto;
    padding: 8px;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 1) 0%,
        rgba(248, 250, 252, 1) 100%
    );
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Type indicator icon */
.offer-type-indicator {
    font-size: 0.85rem;
    color: #667eea;
    transition: all 0.3s ease;
}

/* Offer label/ID */
.offer-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #374151;
    text-align: center;
    line-height: 1.1;
    transition: all 0.3s ease;
}

/* Locked items: distinct style with green theme */
.recent-offer-item.locked {
    background: linear-gradient(
        145deg,
        rgba(254, 242, 242, 1) 0%,
        rgba(254, 226, 226, 1) 100%
    );
    border-color: rgba(239, 68, 68, 0.5);
    border-width: 3px;
}

.recent-offer-item.locked .offer-type-indicator {
    color: #ef4444;
}

.recent-offer-item.locked .offer-label {
    color: #991b1b;
    font-weight: 900;
}

.recent-offer-item.locked:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* Product items: distinct style */
.recent-offer-item.item-product {
    background: linear-gradient(
        145deg,
        rgba(239, 246, 255, 1) 0%,
        rgba(219, 234, 254, 1) 100%
    );
    border-color: rgba(59, 130, 246, 0.4);
}

.recent-offer-item.item-product .offer-type-indicator,
.recent-offer-item.item-product .offer-label {
    color: #3b82f6;
}

/* Idea items */
.recent-offer-item.item-idea {
    background: linear-gradient(
        145deg,
        rgba(250, 245, 255, 1) 0%,
        rgba(243, 232, 255, 1) 100%
    );
    border-color: rgba(168, 85, 247, 0.4);
}

.recent-offer-item.item-idea .offer-type-indicator,
.recent-offer-item.item-idea .offer-label {
    color: #a855f7;
}

/* Locandina items */
.recent-offer-item.item-locandina {
    background: linear-gradient(
        145deg,
        rgba(254, 242, 242, 1) 0%,
        rgba(254, 226, 226, 1) 100%
    );
    border-color: rgba(239, 68, 68, 0.4);
}

.recent-offer-item.item-locandina .offer-type-indicator,
.recent-offer-item.item-locandina .offer-label {
    color: #ef4444;
}

/* Hover effects */
.recent-offer-item:hover {
    transform: scale(1.1) translateY(-2px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow:
        0 8px 25px rgba(102, 126, 234, 0.3),
        0 0 0 3px rgba(102, 126, 234, 0.1);
}

.recent-offer-item:hover .offer-type-indicator,
.recent-offer-item:hover .offer-label {
    color: #fff;
}

.recent-offer-item.item-product:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    box-shadow:
        0 8px 25px rgba(59, 130, 246, 0.3),
        0 0 0 3px rgba(59, 130, 246, 0.1);
}

.recent-offer-item.item-idea:hover {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    border-color: #a855f7;
    box-shadow:
        0 8px 25px rgba(168, 85, 247, 0.3),
        0 0 0 3px rgba(168, 85, 247, 0.1);
}

.recent-offer-item.item-locandina:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #ef4444;
    box-shadow:
        0 8px 25px rgba(239, 68, 68, 0.3),
        0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Remove button - modern minimal style */
.remove-offer-btn {
    position: absolute;
    right: -8px;
    top: -8px;
    font-size: 10px;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4);
    z-index: 1000;
    pointer-events: auto !important;
    opacity: 1; /* Always visible */
    transform: scale(1);
    transition: all 0.2s ease;
}

.remove-offer-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    transform: scale(1.2) !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.6);
}

/* Lock icon for locked offers */
.favorite-toggle-btn {
    position: absolute;
    left: -8px;
    top: -8px;
    font-size: 10px;
    color: #9ca3af;
    background: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: 2px solid #f3f4f6;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.2s;
}

.favorite-toggle-btn:hover {
    transform: scale(1.2);
    color: #ef4444;
    border-color: #fee2e2;
}

.favorite-toggle-btn.active {
    color: white;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Nice scrollbar for the popover */
.rs-popover-body::-webkit-scrollbar {
    width: 6px;
}

.rs-popover-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}

.rs-popover-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.rs-popover-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* The floating preview container */
#recent-offer-preview {
    overflow-y: auto;
    padding: 45px;
}

.offer-details-container {
    border-left: 5px solid #007bff;
}

/* Mobile adjustments for FAB */
@media (max-width: 768px) {
    .recent-searches-fab-container {
        bottom: 15px;
        left: 15px;
    }
    
    .recent-searches-fab {
        width: 70px;
        height: 70px;
    }
    
    .fab-main-icon {
        font-size: 1.5rem;
    }
    
    .circular-text text {
        font-size: 10px;
    }
    
    .recent-searches-popover {
        width: 300px;
    }
}

/* Selection Modal Styles */
.offer-selection-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.offer-selection-item {
    display: flex;
    align-items: center;
    padding: 16px 18px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    position: relative;
}

.offer-selection-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #ced4da;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.offer-selection-item.selected {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.offer-selection-item.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.5);
}

.offer-selection-item .checkbox-wrapper {
    flex-shrink: 0;
    margin-right: 14px;
}

.offer-selection-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #28a745;
    border-radius: 4px;
}

.offer-selection-item .offer-info {
    flex: 1;
    min-width: 0;
}

.offer-selection-item .offer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.offer-selection-item .offer-id {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.offer-selection-item .offer-id.type-offerta {
    background: linear-gradient(135deg, #f7c52d 0%, #e8a819 100%);
    color: #083300;
}

.offer-selection-item .offer-id.type-locandina {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    color: white;
}

.offer-selection-item .offer-id.type-prodotto {
    background: linear-gradient(135deg, #0a4d00 0%, #083300 100%);
    color: #f7c52d;
}

.offer-selection-item .current-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.offer-selection-item .locked-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.offer-selection-item .offer-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    font-size: 15px;
    line-height: 1.3;
}

.offer-selection-item .offer-details {
    font-size: 13px;
    color: #718096;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.offer-selection-item .offer-details span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.offer-selection-item .offer-details i {
    font-size: 11px;
    color: #a0aec0;
}

/* View again button */
.offer-view-again-btn {
    flex-shrink: 0;
    margin-left: auto;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.offer-view-again-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6b3f91 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.offer-view-again-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.offer-view-again-btn i {
    font-size: 12px;
}

/* Category info message */
.selection-category-info {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.selection-category-info.info-offers {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 1px solid #e8a819;
    color: #856404;
}

.selection-category-info.info-products {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    color: #155724;
}

.selection-category-info i {
    font-size: 18px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .offer-selection-list {
        max-height: 50vh;
    }

    .offer-selection-item {
        padding: 14px 12px;
    }

    .offer-selection-item .offer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .offer-selection-item .offer-details {
        flex-direction: column;
        gap: 4px;
    }
}

/* Selection Modal specific styles */
/* Removed max-height and overflow-y from modal-body-modern to prevent background scrolling */
/* Scrolling is now handled by modal-dialog-scrollable on the modal-dialog */

#offerSelectionModal .modal-selection-list {
    min-height: 200px;
}

/* Better scrollbar for selection list */
.modal-selection-list::-webkit-scrollbar {
    width: 8px;
}

.modal-selection-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.modal-selection-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modal-selection-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   TOAST NOTIFICATION SYSTEM
   ======================================== */
.offer-toast {
    position: fixed;
    top: 20px;
    left: 20px;
    min-width: 320px;
    max-width: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateX(-500px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.offer-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.offer-toast-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 48px 16px 16px;
}

.offer-toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.offer-toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

.offer-toast-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.offer-toast-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Toast types */
.offer-toast-success {
    border-left: 4px solid #10b981;
}

.offer-toast-success .offer-toast-icon {
    color: #10b981;
}

.offer-toast-error {
    border-left: 4px solid #ef4444;
}

.offer-toast-error .offer-toast-icon {
    color: #ef4444;
}

.offer-toast-warning {
    border-left: 4px solid #f59e0b;
}

.offer-toast-warning .offer-toast-icon {
    color: #f59e0b;
}

.offer-toast-info {
    border-left: 4px solid #3b82f6;
}

.offer-toast-info .offer-toast-icon {
    color: #3b82f6;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .offer-toast {
        min-width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
        top: 10px;
    }

    .offer-toast.show {
        transform: translateX(0);
    }
}
