/* AI Design Studio - Template Library Styles */

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(99, 102, 241, 0.2);
    }
}

/* Template Cards */
.template-card {
    animation: fadeIn 0.5s ease-out;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    cursor: pointer;
}

.template-card:hover {
    transform: translateY(-4px);
    border-color: #6366F1;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

.template-card.selected {
    border-color: #8B5CF6;
    border-width: 2px;
    animation: pulse-glow 2s infinite;
}

.template-card.selected::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #6366F1, #8B5CF6);
    border-radius: 14px;
    z-index: -1;
    opacity: 0.3;
}

/* Card Image */
.card-image {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #1E293B, #0F172A);
}

.card-image svg {
    transition: transform 0.5s ease;
}

.template-card:hover .card-image svg {
    transform: scale(1.05);
}

/* Badges */
.popular-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.new-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: #10B981;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    z-index: 10;
}

/* Category Items */
.category-item {
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.category-item:hover {
    background: #334155;
}

.category-item.active {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid #6366F1;
}

.category-item.active span:first-child {
    color: #6366F1;
    font-weight: 600;
}

/* Style Buttons */
.style-btn {
    transition: all 0.2s ease;
}

.style-btn:hover {
    transform: translateY(-2px);
    border-color: #6366F1;
}

.style-btn.active {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    border-color: transparent;
}

/* Palette Buttons */
.palette-btn {
    transition: all 0.2s ease;
}

.palette-btn:hover {
    transform: translateX(4px);
    border-color: #6366F1;
}

.palette-btn.active {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    border-color: transparent;
}

.palette-btn.active .flex.gap-1 {
    opacity: 0.9;
}

/* View Buttons */
.view-btn {
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: #334155;
    color: white;
}

.view-btn.active {
    background: #6366F1;
    color: white;
    border-color: #6366F1;
}

/* List View */
.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.list-item:hover {
    transform: translateX(4px);
    border-color: #6366F1;
}

.list-item.selected {
    border-color: #8B5CF6;
    border-width: 2px;
    background: rgba(99, 102, 241, 0.1);
}

.list-preview {
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #1E293B, #0F172A);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-preview svg {
    width: 40px;
    height: 40px;
}

.list-content {
    flex: 1;
}

.list-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.list-category {
    font-size: 0.75rem;
    color: #94A3B8;
}

.list-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* Action Buttons */
.action-btn {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.action-btn:active::after {
    width: 100px;
    height: 100px;
}

/* Color Dots */
.color-dot {
    transition: transform 0.2s ease;
}

.color-dot:hover {
    transform: scale(1.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 1rem;
    grid-column: 1 / -1;
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: #334155;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #94A3B8;
    margin-bottom: 1.5rem;
}

/* Loading Spinner */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar */
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: #1E293B;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #6366F1;
}

/* Responsive */
@media (max-width: 1024px) {
    .lg\:w-\[380px\] {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #334155;
    }
    
    .list-item {
        flex-wrap: wrap;
    }
    
    .list-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }
}

@media (max-width: 640px) {
    .list-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .list-preview {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }
    
    .list-actions {
        width: 100%;
    }
    
    .list-actions button {
        flex: 1;
    }
}