/* 
    Idea Generator Widget CSS 
    Design: Glassmorphism, Vibrant Gradients, Premium Animations
*/
:root {
    --ig-primary: #6366f1; /* Indigo */
    --ig-primary-hover: #4f46e5;
    --ig-secondary: #ec4899; /* Pink */
    --ig-gradient: var(--ig-primary);
    --ig-bg-glass: #ffffff;
    --ig-border-glass: rgba(0, 0, 0, 0.05);
    --ig-text: #1f2937;
    --ig-text-light: #6b7280;
    --ig-shadow: 0 10px 30px -10px rgba(0,0,0,0.15);
    --ig-radius: 20px;
    --ig-z-index: 99999;
}

/* Floating Icon Container */
.ig-widget-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: var(--ig-z-index);
    font-family: 'Inter', 'Roboto', sans-serif;
}

/* Pulsing portal ring behind the button */
.ig-widget-container::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 65px;
    height: 65px;
    background: var(--ig-primary);
    border-radius: 50%;
    z-index: 0;
    animation: ig-pulse-ring 2.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes ig-pulse-ring {
    0% { transform: scale(0.9); opacity: 0.5; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Floating Icon (3D Sphere Look) */
.ig-floating-icon {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #818cf8, var(--ig-primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        inset 0 4px 6px rgba(255, 255, 255, 0.4),
        inset 0 -4px 6px rgba(0, 0, 0, 0.2),
        0 10px 25px rgba(99, 102, 241, 0.5);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
    position: relative;
    z-index: 5;
    animation: ig-float 3s ease-in-out infinite;
}

@keyframes ig-float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

.ig-main-icon {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

.ig-widget-container:hover .ig-floating-icon {
    animation-play-state: paused;
    transform: scale(1.05);
    box-shadow: 
        inset 0 4px 6px rgba(255, 255, 255, 0.5),
        inset 0 -4px 6px rgba(0, 0, 0, 0.2),
        0 15px 35px rgba(99, 102, 241, 0.7);
}

/* Robot Peeking - 3D Pop Out Effect */
.ig-robot-peek {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(30px) scale(0.3) rotate(-15deg);
    width: 90px;
    height: 90px;
    z-index: 1; /* Behind the main icon */
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    pointer-events: none;
}

.ig-robot-peek img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.4)); /* Strong 3D shadow */
    animation: ig-wiggle 3s ease-in-out infinite;
    animation-play-state: paused; /* Only wiggle on hover */
}

@keyframes ig-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.ig-widget-container:hover .ig-robot-peek {
    /* Pop up, scale up, straighten out */
    transform: translateX(-50%) translateY(-75px) scale(1) rotate(0deg);
    opacity: 1;
}

.ig-widget-container:hover .ig-robot-peek img {
    animation-play-state: running; /* Start wiggling when popped out */
}

.ig-tooltip {
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    background: white;
    color: var(--ig-text);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--ig-shadow);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.ig-widget-container:hover .ig-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Modal Styling (Glassmorphism) */
.ig-modal {
    position: absolute;
    bottom: 85px;
    left: 0;
    width: 650px;
    max-width: calc(100vw - 40px);
    background: var(--ig-bg-glass);
    border: 1px solid var(--ig-border-glass);
    border-radius: var(--ig-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    /* Removed overflow: hidden so robot can pop out */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
}

.ig-modal.show {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.ig-modal-header {
    background: var(--ig-gradient);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--ig-radius) var(--ig-radius) 0 0;
}

.ig-header-content {
    display: flex;
    align-items: center;
    gap: 25px;
}

.ig-header-icon-box {
    background: transparent;
    width: 60px; /* Smaller on mobile to fit text */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-header-robot {
    position: absolute;
    bottom: -15px; /* Adjust for smaller size */
    left: 50%;
    transform: translateX(-50%);
    width: 100px; /* Smaller on mobile */
    height: auto;
    filter: drop-shadow(0 15px 20px rgba(0,0,0,0.4));
    z-index: 10;
    animation: ig-header-float 3s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes ig-header-float {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
    25% { transform: translateX(-50%) translateY(-2px) rotate(-3deg); }
    75% { transform: translateX(-50%) translateY(-2px) rotate(3deg); }
}

.ig-header-content h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.ig-header-content p {
    margin: 5px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.ig-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ig-close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Body & Steps */
.ig-modal-body {
    padding: 25px;
    min-height: 250px;
    position: relative;
    max-height: 60vh;
    overflow-y: auto;
}

.ig-step {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.ig-step.active {
    display: block;
}

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

.ig-step h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ig-text);
    text-align: center;
}

.ig-step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.ig-step-header i {
    font-size: 24px;
    color: var(--ig-primary);
}

.ig-step-header h4 {
    margin: 0;
    text-align: left;
    font-size: 16px;
}

.ig-step-header p {
    margin: 5px 0 0 0;
    font-size: 13px;
    color: var(--ig-text-light);
    text-align: left;
}

/* Options Grid */
.ig-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.ig-options-grid.ig-4-cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.ig-option-card {
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    position: relative;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
}

.ig-option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.ig-option-card.selected {
    border-color: var(--ig-primary);
}

.ig-option-card img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
    background: white;
}

.ig-card-content h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ig-text);
}

.ig-card-content span {
    font-size: 12px;
    color: var(--ig-text-light);
    display: block;
    margin-top: 2px;
}

/* Arrow Button */
.ig-card-arrow {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ig-option-card:hover .ig-card-arrow {
    opacity: 1;
}

/* Background Colors */
.ig-bg-blue { background: #f0f9ff; }
.ig-bg-green { background: #f0fdf4; }
.ig-bg-purple { background: #faf5ff; }
.ig-bg-orange { background: #fff7ed; }

/* Arrow Colors */
.ig-arrow-blue { background: #3b82f6; }
.ig-arrow-green { background: #22c55e; }
.ig-arrow-purple { background: #a855f7; }
.ig-arrow-orange { background: #f97316; }

.ig-divider {
    border: 0;
    border-top: 1px dashed rgba(0,0,0,0.1);
    margin: 25px 0;
}

/* Results Section */
.ig-results-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 500px) {
    .ig-header-icon-box {
        width: 130px; /* Big gap for big robot */
    }
    .ig-header-robot {
        width: 190px; /* Giant robot */
        bottom: -35px; /* Pull down */
    }
    .ig-options-grid.ig-4-cols {
        grid-template-columns: repeat(4, 1fr);
    }
    .ig-modal {
        width: 750px;
    }
    .ig-results-container {
        flex-direction: row;
    }
    .ig-results-col {
        flex: 1;
        width: 50%;
    }
}

.ig-results-col h4 {
    font-size: 14px;
    text-align: left;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(0,0,0,0.05);
}

.ig-results-col h4 i {
    color: var(--ig-primary);
    margin-right: 5px;
}

.ig-scrollable-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar */
.ig-scrollable-list::-webkit-scrollbar {
    width: 6px;
}
.ig-scrollable-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
}
.ig-scrollable-list::-webkit-scrollbar-thumb {
    background: var(--ig-primary);
    border-radius: 10px;
}

/* Items */
.ig-item-card {
    background: white;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    gap: 12px;
    transition: transform 0.2s ease;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0,0,0,0.05);
}

.ig-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-color: var(--ig-primary);
}

.ig-item-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
}

.ig-item-info {
    flex: 1;
    overflow: hidden;
}

.ig-item-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--ig-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ig-item-desc {
    font-size: 11px;
    color: var(--ig-text-light);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ig-item-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--ig-primary);
    margin-top: 4px;
}

/* Loader */
.ig-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.ig-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-left-color: var(--ig-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Footer Buttons */
.ig-modal-footer {
    margin-top: 20px;
    text-align: center;
}

.ig-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ig-btn-secondary {
    background: rgba(0,0,0,0.05);
    color: var(--ig-text);
}

.ig-btn-secondary:hover {
    background: rgba(0,0,0,0.1);
}

/* Info Footer */
.ig-info-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.ig-info-footer i {
    color: var(--ig-text-light);
    font-size: 18px;
}

.ig-info-footer p {
    margin: 0;
    font-size: 12px;
    color: var(--ig-text-light);
    flex: 1;
}

.ig-btn-view-all {
    background: #eef2ff;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ig-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.ig-btn-view-all:hover {
    background: #e0e7ff;
}

/* Add to Cart Button */
.ig-btn-add-cart {
    background: var(--ig-primary);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.ig-btn-add-cart:hover {
    background: var(--ig-primary-hover);
}
