/* Custom Styles for Word Blender */

/* Word Item Styles */
.word-item {
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Color variations for words based on first letter */
.word-color-1 {
    background: linear-gradient(135deg, #ff7eb3, #ff758c);
    color: white;
    border: none;
}

.word-color-2 {
    background: linear-gradient(135deg, #7ee8fa, #80d0c7);
    color: #1a202c;
    border: none;
}

.word-color-3 {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    color: #1a202c;
    border: none;
}

.word-color-4 {
    background: linear-gradient(135deg, #d299c2, #fef9d7);
    color: #1a202c;
    border: none;
}

.word-color-5 {
    background: linear-gradient(135deg, #fddb92, #d1fdff);
    color: #1a202c;
    border: none;
}

.word-color-6 {
    background: linear-gradient(135deg, #9890e3, #b1f4cf);
    color: #1a202c;
    border: none;
}

.word-color-7 {
    background: linear-gradient(135deg, #96e6a1, #d4fc79);
    color: #1a202c;
    border: none;
}

.word-color-8 {
    background: linear-gradient(135deg, #f6d365, #fda085);
    color: white;
    border: none;
}

/* Hover effect */
.word-item:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Selected state */
.word-item.selected {
    background: linear-gradient(135deg, #6157ff, #ee49fd);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(97, 87, 255, 0.4);
    z-index: 1;
}

.word-item.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    animation: pulse 1.5s infinite;
}

/* For generated words */
.badge-primary {
    background: linear-gradient(135deg, #6157ff, #ee49fd);
    color: white;
    border: none;
}

/* Word Slot Styles */
.word-slot {
    transition: all 0.3s ease;
}

.word-slot.filled {
    border: 2px solid #9f7aea;
    background-color: rgba(159, 122, 234, 0.1);
}

#blended-word {
    animation: colorCycle 8s infinite;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

/* Image Styles */
.image-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    cursor: pointer;
}

.image-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(138, 75, 255, 0.3);
}

.image-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    pointer-events: none;
}

.image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.image-item:hover img {
    transform: scale(1.1);
}

.image-item .caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    color: white;
    font-weight: 600;
    text-align: center;
    text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.7);
    z-index: 1;
}

#current-image img {
    max-height: 350px;
    width: auto;
    border-radius: 0.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin: 0;
    object-fit: contain;
}

/* Loading overlay styles */
#image-loading {
    border-radius: 0.5rem;
    backdrop-filter: blur(3px);
    transition: all 0.3s ease;
}

.card-body {
    padding: 1rem;
}

/* Animation Keyframes */
@keyframes pulse {
    0% { opacity: 0.1; }
    50% { opacity: 0.3; }
    100% { opacity: 0.1; }
}

@keyframes colorCycle {
    0% { color: #9f7aea; }
    25% { color: #667eea; }
    50% { color: #f687b3; }
    75% { color: #68d391; }
    100% { color: #9f7aea; }
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes appear {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.appear-animation {
    animation: appear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Modal animation */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#image-modal {
    animation: modalFadeIn 0.3s ease-out;
}

#image-modal.hidden {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 0.75rem;
    }
    
    .word-item {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    #current-image img {
        max-height: 300px;
    }
    
    .image-item img {
        height: 120px;
    }
}

@media (max-width: 480px) {
    .image-item img {
        height: 100px;
    }
}

#global-gen-count-badge {
    font-size: 1.1rem;
    padding: 0.6em 0.8em;
    line-height: 1.2;
    vertical-align: middle;
    transition: background-color 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}

#view-all-blends-btn {
    transition: all 0.3s ease;
    animation: pulse-light 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

#view-all-blends-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(138, 75, 255, 0.5);
    animation: none; /* Stop pulsing on hover */
}

@keyframes pulse-light {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 5px rgba(138, 75, 255, 0.2);
  }
  50% {
    opacity: .8;
    box-shadow: 0 0 10px rgba(138, 75, 255, 0.4);
  }
}