/**
 * TIM Ecommerce Styles - Modern Redesign
 */

:root {
    --tim-blue: #005cbb;
    --tim-blue-dark: #00448a;
    --tim-red: #e60000;
    --tim-gray-bg: #f8fafc;
    --tim-card-bg: #ffffff;
    --tim-text-main: #1f2937;
    --tim-text-light: #6b7280;
    --tim-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --tim-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --tim-radius: 16px;
    --tim-radius-sm: 8px;
    --tim-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Container principale */
.tim-ecommerce-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: var(--tim-font);
    color: var(--tim-text-main);
}

/* Header */
.tim-shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

/* Floating Cart Button */
.tim-floating-cart {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    top: auto !important;
    left: auto !important;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--tim-blue) 0%, var(--tim-blue-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 92, 187, 0.4);
    z-index: 2147483647 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: none;
}

.tim-floating-cart:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 92, 187, 0.5);
}

.tim-floating-cart:active {
    transform: scale(0.95);
}

.tim-floating-cart-icon {
    font-size: 28px;
    filter: grayscale(1) brightness(10);
}

.tim-floating-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--tim-red);
    color: white;
    font-size: 13px;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(230, 0, 0, 0.4);
    font-family: var(--tim-font);
}

/* Animazione pulse quando viene aggiunto un prodotto */
@keyframes tim-cart-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.tim-floating-cart.pulse {
    animation: tim-cart-pulse 0.5s ease;
}

/* Filtri Moderni */
.tim-filters-container {
    background: white;
    padding: 25px;
    border-radius: var(--tim-radius);
    box-shadow: var(--tim-shadow);
    margin-bottom: 40px;
    border: 1px solid #f3f4f6;
}

.tim-filters-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--tim-text-main);
}

/* Griglia filtri responsive */
.tim-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 20px;
}

.tim-filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--tim-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tim-filter {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: var(--tim-radius-sm);
    font-size: 15px;
    color: var(--tim-text-main);
    background: #f9fafb;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.tim-filter:focus {
    outline: none;
    border-color: var(--tim-blue);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(0, 92, 187, 0.1);
}

/* Price Filter - Ensure consistent layout */
.tim-price-filter-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    min-width: 100%;
    /* Force full width */
    flex-basis: 100%;
    margin-top: 15px;
    order: 100;
    /* Move to end */
}

/* Modern Price Slider Inputs */
.tim-price-inputs {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
    /* Increase gap */
}

.tim-price-field {
    display: flex;
    flex-direction: column;
    flex: 1;
    /* Take available space */
}

.tim-price-field span {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 5px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.tim-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.tim-price-inputs input {
    width: 100%;
    padding: 10px 35px 10px 12px;
    /* Balanced padding */
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tim-text-main);
    background: white;
    font-family: 'Inter', sans-serif;
    -moz-appearance: textfield;
    transition: border-color 0.2s;
}

.tim-price-inputs input:focus {
    border-color: var(--tim-blue);
    outline: none;
}

.tim-input-wrapper .currency {
    position: absolute;
    right: 12px;
    font-size: 14px;
    color: #999;
    pointer-events: none;
    font-weight: 500;
}

.tim-price-separator {
    color: #bbb;
    font-weight: 300;
    margin-top: 15px;
    /* Align with input box vertical center roughly */
    font-size: 20px;
}

/* Slider CSS */
.tim-price-slider {
    margin-top: 20px;
    height: 6px;
    border-radius: 3px;
    border: none;
    box-shadow: none;
    background: #e5e7eb;
}

.tim-price-slider .noUi-connect {
    background: var(--tim-blue);
}

.tim-price-slider .noUi-handle {
    width: 20px;
    height: 20px;
    right: -10px;
    top: -7px;
    border-radius: 50%;
    border: 2px solid var(--tim-blue);
    background: #fff;
    box-shadow: 0 4px 6px rgba(0, 38, 127, 0.15);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tim-price-slider .noUi-handle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 38, 127, 0.25);
}

.tim-price-slider .noUi-handle:before,
.tim-price-slider .noUi-handle:after {
    display: none;
}

/* Reset Button */
.tim-filter-reset {
    width: 100%;
    text-align: center;
    margin-top: 20px;
}

.tim-filter-reset button {
    background: none;
    border: 1px solid #eee;
    padding: 8px 20px;
    border-radius: 20px;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tim-filter-reset button:hover {
    background: #f5f5f5;
    color: var(--tim-red);
    border-color: #ddd;
}

/* Contatore prodotti */
#tim-count-visible {
    font-weight: 700;
    color: var(--tim-blue);
}

/* Featured Section */
.tim-featured-section {
    position: relative;
    margin-bottom: 40px;
}

.tim-featured-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--tim-text-main);
}



/* Help Banner */
.tim-help-banner {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--tim-radius);
    margin-bottom: 40px;
    overflow: hidden;
    box-shadow: var(--tim-shadow);
    color: var(--tim-text-main);
    /* Dark text might be better on light background, but checking contrast */
    position: relative;
    min-height: 180px;
    /* Minimum height for width */
    display: flex;
    align-items: center;
}

.tim-help-content {
    padding: 30px 40px;
    width: 60%;
    /* Limit text width to not cover the character on the right */
    position: relative;
    z-index: 2;
}

.tim-help-text h3 {
    color: var(--tim-blue);
    /* Blue text for better visibility on light bg */
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px 0;
}

.tim-help-text p {
    font-size: 16px;
    margin: 0 0 20px 0;
    color: var(--tim-text-main);
    font-weight: 500;
    max-width: 450px;
}

.tim-btn-light {
    background: var(--tim-blue);
    color: white;
    border: none;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 92, 187, 0.3);
}

.tim-btn-light:hover {
    background: var(--tim-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 92, 187, 0.4);
    color: white;
}

@media (max-width: 768px) {
    .tim-help-banner {
        background-position: 70% center;
        /* Adjust for mobile */
        text-align: center;
    }

    .tim-help-content {
        width: 100%;
        padding: 40px 20px;
        background: rgba(255, 255, 255, 0.85);
        /* Readability overlay on mobile if needed */
        backdrop-filter: blur(5px);
    }

    .tim-help-text p {
        margin: 0 auto 20px auto;
    }
}

/* Carousel Arrows */
.tim-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--tim-blue);
    color: white;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 92, 187, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tim-carousel-arrow:hover {
    background: var(--tim-blue-dark);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 92, 187, 0.5);
}

.tim-carousel-prev {
    left: -22px;
}

.tim-carousel-next {
    right: -22px;
}

/* Featured Carousel */

.tim-featured-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding-bottom: 20px;
    margin-bottom: 40px;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tim-featured-carousel::-webkit-scrollbar {
    display: none;
}

.tim-featured-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--tim-radius);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--tim-shadow);
}

.tim-featured-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--tim-shadow-hover);
    border-color: var(--tim-blue);
}

.tim-featured-image {
    height: 180px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.tim-featured-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tim-featured-info {
    padding: 15px;
    text-align: center;
}

.tim-featured-info h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--tim-text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.tim-featured-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--tim-blue);
    margin-bottom: 12px;
}

/* Grid prodotti */
.tim-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
    position: relative;
}

/* Card prodotto - Design Premium */
.tim-product-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: var(--tim-radius);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.tim-product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--tim-shadow-hover);
    border-color: rgba(0, 92, 187, 0.1);
}

/* Badge */
.tim-badge-pronta {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #10b981;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

/* Immagine prodotto */
.tim-product-image {
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #ffffff;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tim-product-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.tim-product-card:hover .tim-product-image img {
    transform: scale(1.05);
}

/* Info prodotto */
.tim-product-info {
    padding: 25px;
}

.tim-product-info h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.4;
    color: var(--tim-text-main);
    min-height: 50px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tim-product-brand {
    color: var(--tim-blue);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tim-product-category {
    color: var(--tim-text-light);
    font-size: 12px;
    margin-bottom: 15px;
}

/* Prezzi */
.tim-product-prices {
    margin: 20px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: var(--tim-radius-sm);
    text-align: center;
}

.tim-price-rata {
    color: var(--tim-blue);
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 5px;
    display: block;
}

.tim-price-rata span {
    font-size: 14px;
    font-weight: 500;
    color: var(--tim-text-light);
}

.tim-price-unica {
    color: var(--tim-text-main);
    font-size: 14px;
    font-weight: 600;
    opacity: 0.8;
}

/* Stock */
.tim-product-stock {
    margin: 15px 0 0 0;
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.tim-in-stock {
    color: #10b981;
}

.tim-out-stock {
    color: #ef4444;
}

/* Bottoni Moderni */
.tim-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.tim-btn-primary {
    background: var(--tim-blue);
    color: white;
    width: 100%;
}

.tim-btn-primary:hover {
    background: var(--tim-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 92, 187, 0.3);
}

.tim-btn-secondary {
    background: white;
    border: 1px solid #e5e7eb;
    color: var(--tim-text-main);
}

.tim-btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.tim-btn-danger {
    background: #ef4444;
    color: white;
}

.tim-btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

/* Modal Moderno - Glassmorphism fix */
.tim-modal {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    /* Structural Fixes */
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    display: none;
}

.tim-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: var(--tim-font);
    /* Alignment Fixes */
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.tim-modal-close {
    position: absolute;
    top: 25px;
    right: 30px;
    font-size: 32px;
    color: #9ca3af;
    transition: color 0.3s;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.tim-modal-close:hover {
    color: var(--tim-text-main);
}

/* Tabella carrello */
.tim-cart-table {
    margin: 30px 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    font-family: var(--tim-font);
}

.tim-cart-table th {
    background: #f8fafc;
    color: var(--tim-text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
    padding: 16px;
}

.tim-cart-table td {
    padding: 20px;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

.tim-cart-table tr:last-child td {
    border-bottom: none;
}

.tim-cart-table img {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Selezione pagamento */
.tim-payment-selection {
    margin: 30px 0;
    padding: 25px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .tim-ecommerce-container {
        padding: 0 15px;
    }

    .tim-product-image {
        height: 200px;
    }

    .tim-filters-grid {
        grid-template-columns: 1fr;
    }

    .tim-modal-content {
        padding: 25px;
        margin: 10% auto;
        width: 95%;
    }
}

/* Appointment Styles */
.tim-appointments-grid {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 10px;
}

.tim-day-column {
    min-width: 150px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    background: #f9fafb;
}

.tim-day-column h4 {
    text-align: center;
    margin: 0 0 10px 0;
    color: var(--tim-blue);
}

.tim-day-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tim-slot-btn {
    padding: 8px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tim-slot-btn:hover {
    border-color: var(--tim-blue);
    color: var(--tim-blue);
}

.tim-slot-btn.selected {
    background: var(--tim-blue);
    color: white;
    border-color: var(--tim-blue);
}

.tim-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.tim-error {
    text-align: center;
    padding: 20px;
    color: #ef4444;
}