/**
 * RaiseFi Sidebar Integration Styles
 * Handles styling for sidebar components and interactions
 *
 * @package RaiseFi
 * @version 3.0.0
 */

/* Sidebar container */
.raisefi-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 350px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.raisefi-sidebar.open {
    transform: translateX(0);
}

/* Sidebar header */
.raisefi-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.raisefi-sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Sidebar content */
.raisefi-sidebar-content {
    padding: 20px;
}

/* Reward cards */
.reward-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.reward-card.highlighted {
    border-color: #667eea;
    background: #f0f2ff;
}

.reward-card.selected {
    border-color: #28a745;
    background: #f0f9f0;
}

/* Reward card content */
.reward-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.reward-price {
    font-size: 14px;
    color: #667eea;
    font-weight: 500;
    margin-bottom: 8px;
}

.reward-description {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Selection indicator */
.selection-indicator {
    display: none;
    font-size: 12px;
    color: #28a745;
    font-weight: 500;
    margin-top: 8px;
}

/* Connection effects */
.connection-line {
    pointer-events: none;
    z-index: 999;
}

/* Pulse effect */
.pulse-effect {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* Quantity controls */
.quantity-controls {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: #f0f0f0;
}

.quantity-input {
    width: 60px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    margin: 0 10px;
    font-size: 14px;
}

/* Fund button */
.fund-reward-button {
    width: 100%;
    max-width: 200px;
    padding: 8px 10px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin: 15px auto 0 auto;
}

.fund-reward-button:hover {
    background: #218838;
}

.fund-reward-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Keep sidebar reward buttons on the brand orange even though modal styles are also loaded */
.raisefi-reward-card .raisefi-fund-reward-btn {
    background: #ff9500;
    color: #fff;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.raisefi-reward-card .raisefi-fund-reward-btn:hover:not(:disabled) {
    background: #e28400;
    box-shadow: 0 4px 10px rgba(255, 149, 0, 0.35);
}

.raisefi-reward-card .raisefi-fund-reward-btn:disabled {
    background: #6c757d;
    box-shadow: none;
}

/* Popover styles */
.reward-popover {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    max-width: 250px;
    display: none;
}

.reward-popover-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.reward-popover-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .raisefi-sidebar {
        width: 100%;
        max-width: 350px;
    }
    
    /* Mobile: Full-width reward cards */
    .reward-popover {
        max-width: 100%;
    }
}

/* Loading states */
.sidebar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error states */
.sidebar-error {
    padding: 20px;
    text-align: center;
    color: #dc3545;
}

.sidebar-error-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.sidebar-error-message {
    font-size: 14px;
    margin-bottom: 15px;
}

.sidebar-retry-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.sidebar-retry-btn:hover {
    background: #c82333;
}