/* Filament Inventory Styles */

/* Colore primario dinamico - iniettato da WordPress via PHP */
:root {
    --f3d-primary-color: #3b82f6; /* Fallback default, sovrascritto da PHP con il colore WordPress */
}

/* Override classi Tailwind blu per usare il colore dinamico */
.f3d-filament-inventory-wrapper .bg-blue-600 {
    background-color: var(--f3d-primary-color) !important;
}

.f3d-filament-inventory-wrapper .bg-blue-50 {
    background-color: color-mix(in srgb, var(--f3d-primary-color) 10%, white) !important;
}

.f3d-filament-inventory-wrapper .border-blue-100 {
    border-color: color-mix(in srgb, var(--f3d-primary-color) 20%, white) !important;
}

.f3d-filament-inventory-wrapper .border-blue-200 {
    border-color: color-mix(in srgb, var(--f3d-primary-color) 30%, white) !important;
}

.f3d-filament-inventory-wrapper .text-blue-400 {
    color: color-mix(in srgb, var(--f3d-primary-color) 70%, white) !important;
}

.f3d-filament-inventory-wrapper .text-blue-600 {
    color: var(--f3d-primary-color) !important;
}

.f3d-filament-inventory-wrapper .text-blue-800 {
    color: color-mix(in srgb, var(--f3d-primary-color) 90%, black 20%) !important;
}

.f3d-filament-inventory-wrapper .text-blue-900 {
    color: color-mix(in srgb, var(--f3d-primary-color) 80%, black 30%) !important;
}

.f3d-filament-inventory-wrapper .shadow-blue-200 {
    --tw-shadow-color: color-mix(in srgb, var(--f3d-primary-color) 30%, white);
}

.f3d-filament-inventory-wrapper .hover\:text-blue-600:hover {
    color: var(--f3d-primary-color) !important;
}

/* Base translucent pattern */
.translucent {
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

/* Filament Card Styles */
.filament-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.filament-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Group Container for Selected Filaments */
.group-container {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    gap: 2px;
    border: 1px solid #e2e8f0;
    align-items: stretch;
}

/* Mini Card in Selection Box */
.mini-card {
    cursor: pointer;
    width: 80px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.mini-card:hover {
    filter: brightness(0.95);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--f3d-primary-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Material Filter Buttons */
.material-btn {
    transition: all 0.2s;
}

.material-btn.active {
    background-color: #1e293b;
    color: white;
    border-color: #1e293b;
}

/* Sticky Accordion */
.sticky-accordion {
    top: 0.5rem;
    z-index: 50;
}

/* Accordion Content */
.accordion-content {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    border-top: 1px solid #e5e7eb;
}

.accordion-content.collapsed {
    max-height: 0;
    opacity: 0;
    border-top: none;
    overflow: hidden;
}

/* Accordion Toggle Button Animation */
.accordion-toggle-btn {
    transition: transform 0.3s ease;
}

.accordion-toggle-btn.rotated {
    transform: rotate(180deg);
}

/* Mini Switch for Accordion */
.switch-mini {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch-mini input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-mini {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 18px;
}

.slider-mini:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch-mini input:checked + .slider-mini {
    background-color: var(--f3d-primary-color);
}

.switch-mini input:checked + .slider-mini:before {
    transform: translateX(14px);
}

/* Mini Material Dropdown */
.material-dropdown-mini {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    max-width: 80px;
}

/* Mini Color Dropdown */
.color-dropdown-mini {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    max-width: 100px;
}

/* Icon Toggle Buttons */
.icon-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-toggle-btn:hover {
    background: #e2e8f0;
}

.icon-toggle-btn.active {
    background: var(--f3d-primary-color);
    color: white;
}

/* Grid Columns Dynamic */
.grid-cols-dynamic-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.grid-cols-dynamic-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.grid-cols-dynamic-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* Mini Card più piccole per mobile */
.mini-card-compact {
    width: 60px;
}

.mini-card-compact .h-6 {
    height: 1rem;
}

.mini-card-compact .text-\[9px\] {
    font-size: 8px;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    #accordion-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    #accordion-header > div:nth-child(2) {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .material-dropdown-mini {
        max-width: 70px;
        font-size: 10px;
    }

    .color-dropdown-mini {
        max-width: 80px;
        font-size: 10px;
    }
}

/* Blog Link */
.blog-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-weight: 700;
    text-decoration: underline;
    color: var(--f3d-primary-color);
    transition: color 0.2s;
}

.blog-link:hover {
    filter: brightness(1.1);
}

/* Color Bubble Picker */
.color-bubble {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.color-bubble:hover {
    transform: scale(1.15);
}

.color-bubble.active {
    border-color: var(--f3d-primary-color);
    box-shadow: 0 0 0 2px white inset;
}

.color-bubble.translucent-bubble {
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 6px 6px;
    background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
}

/* Animation for info box */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-in-from-top {
    from { transform: translateY(-1rem); }
    to { transform: translateY(0); }
}

.animate-in {
    animation: fade-in 0.3s ease-out, slide-in-from-top 0.3s ease-out;
}
