/**
 * ML Taxonomy Bento - Frontend Styles
 * shadcn-inspired dark Bento grid
 */

/* Container - fills parent, adapts to any size */
.ml-bento-container {
    width: 100%;
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Grid - responsive Bento layout */
.ml-bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--ml-bento-min-width, 200px), 1fr));
    grid-auto-rows: minmax(120px, auto);
    grid-auto-flow: dense;
    gap: var(--ml-bento-gap, 16px);
    width: 100%;
}

/* Bento Item - base styles */
.ml-bento-item {
    position: relative;
    grid-column: span var(--col-span, 1);
    grid-row: span var(--row-span, 1);
    min-height: 120px;
    border-radius: var(--ml-bento-radius, 20px);
    overflow: hidden;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ml-bento-item:hover {
    transform: translateY(-4px) scale(1.02);
    z-index: 10;
}

/* Item Inner - glass effect container */
.ml-bento-item-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: 24px;
    background: var(--ml-bento-bg, rgba(24, 24, 27, 0.6));
    border: 1px solid var(--ml-bento-border, rgba(39, 39, 42, 0.8));
    border-radius: inherit;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.ml-bento-item:hover .ml-bento-item-inner {
    background: rgba(24, 24, 27, 0.8);
    border-color: var(--ml-bento-primary, #3b82f6);
    box-shadow:
        0 20px 40px -15px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--ml-bento-primary, #3b82f6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Content */
.ml-bento-content {
    display: flex;
    flex-direction: row;
    gap: 5px;
    z-index: 2;
    align-content: center;
    align-items: center;
}

.ml-bento-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ml-bento-text, #fafafa);
    line-height: 1.3;
    letter-spacing: -0.02em;
    transition: color 0.3s ease;
}

.ml-bento-item:hover .ml-bento-title {
    color: var(--ml-bento-primary, #3b82f6);
}

.ml-bento-count {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(161, 161, 170, 0.8);
    transition: color 0.3s ease;

}

.ml-bento-item:hover .ml-bento-count {
    color: rgba(250, 250, 250, 0.7);
}

/* Arrow icon */
.ml-bento-arrow {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--ml-bento-text, #fafafa);
    opacity: 0.5;
    transition: all 0.3s ease;
    z-index: 2;
}

.ml-bento-item:hover .ml-bento-arrow {
    opacity: 1;
    background: var(--ml-bento-primary, #3b82f6);
    border-color: var(--ml-bento-primary, #3b82f6);
}

.ml-bento-arrow svg {
    width: 20px;
    height: 20px;
}

/* Static glow effect - top left to highlight title */
.ml-bento-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle at center,
            rgba(59, 130, 246, 0.2),
            transparent 70%);
    transform: translate(-40%, -40%);
    pointer-events: none;
    z-index: 1;
}

/* Size variants - only layout differences, not styling */
.ml-bento-tall .ml-bento-content {
    flex: 1;
    justify-content: flex-end;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ml-bento-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        grid-auto-rows: minmax(100px, auto);
    }

    .ml-bento-item {
        grid-column: span min(var(--col-span, 1), 2) !important;
    }
}

@media (max-width: 480px) {
    .ml-bento-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .ml-bento-item {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 100px;
    }

    .ml-bento-lg,
    .ml-bento-md {
        grid-column: span 2 !important;
    }
}

/* Animation on scroll - optional enhancement */
@keyframes bentoFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ml-bento-item {
    animation: bentoFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.ml-bento-item:nth-child(1) {
    animation-delay: 0ms;
}

.ml-bento-item:nth-child(2) {
    animation-delay: 50ms;
}

.ml-bento-item:nth-child(3) {
    animation-delay: 100ms;
}

.ml-bento-item:nth-child(4) {
    animation-delay: 150ms;
}

.ml-bento-item:nth-child(5) {
    animation-delay: 200ms;
}

.ml-bento-item:nth-child(6) {
    animation-delay: 250ms;
}

.ml-bento-item:nth-child(7) {
    animation-delay: 300ms;
}

.ml-bento-item:nth-child(8) {
    animation-delay: 350ms;
}

.ml-bento-item:nth-child(n+9) {
    animation-delay: 400ms;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {

    .ml-bento-item,
    .ml-bento-item-inner,
    .ml-bento-arrow,
    .ml-bento-glow {
        transition: none;
        animation: none;
    }
}

/* =========================================
   LIST VIEW STYLES
   ========================================= */

.ml-list-container {
    width: 100%;
    font-family: "IBM Plex Sans", Sans-serif;
}

.ml-list-grid {
    display: grid;
    grid-template-columns: repeat(var(--ml-list-columns, 1), 1fr);
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ml-list-item {
    margin: 0;
    padding: 0;
}

.ml-list-link {
    display: flex;
    align-items: center;

    gap: 5px;
    padding: 0px;

    border: 1px solid transparent;
    border-radius: var(--ml-bento-radius, 5px);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    height: 23px;
}



.ml-list-name {
    color: var(--e-global-color-text, #c8c8c8);
    font-family: "IBM Plex Sans", Sans-serif;
    font-weight: 600;
    transition: color 0.2s ease;

}

.ml-list-link:hover .ml-list-name,
.ml-list-link:hover .ml-list-count {
    color: var(--e-global-color-primary, #3b82f6);
}

.ml-list-count {
    color: var(--e-global-color-text, #c8c8c8);
    font-size: 0.8rem;
    font-weight: 300;
    transition: color 0.2s ease;
    margin-top: 2px;
}

/* List view responsive */
@media (max-width: 768px) {
    .ml-list-grid {
        grid-template-columns: repeat(min(var(--ml-list-columns, 1), 2), 1fr);
    }

    .ml-list-link {
        padding: 10px 14px;
        font-size: calc(var(--ml-list-font-size, 16px) * 0.9);
    }
}

@media (max-width: 480px) {
    .ml-list-grid {
        grid-template-columns: 1fr;
    }
}