/**
 * Dilettanti Category Custom Styles
 * Responsive styles for tabs navigation and widget layout
 */

/* ========================================
   DILETTANTI HEADER
   ======================================== */

/* Removed - using original JNews header */

/* ========================================
   TABS NAVIGATION - COMPACT VERSION
   ======================================== */

.dilettanti-tabs-container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    margin-bottom: 1.5rem;
    width: 100%; /* Full width container */
}

.dilettanti-tabs-wrapper {
    position: relative;
    width: 100%;
}

.dilettanti-tabs-nav {
    display: flex;
    flex-wrap: nowrap; /* Desktop: single row */
    justify-content: space-between; /* Distribute evenly across full width */
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.4rem; /* Reduced gap */
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    width: 100%; /* Use full width */
}

/* Desktop: items grow to fill space proportionally */
.dilettanti-tab-item {
    flex: 1 1 0; /* Equal flex-grow, allow shrink, base 0 */
    margin: 0;
    padding: 0;
    min-width: 0; /* Allow items to shrink below content size */
}

.dilettanti-tab-button {
    display: block;
    width: 100%; /* Fill parent container */
    padding: 0.5rem 0.4rem; /* Reduced horizontal padding */
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #495057;
    font-size: 0.75rem; /* Smaller font for better fit */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis; /* Handle overflow gracefully */
}

.dilettanti-tab-button:hover {
    background: #e9ecef;
    color: #212529;
    border-color: #ced4da;
}

.dilettanti-tab-button.active {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}

.dilettanti-tab-button:focus {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

/* ========================================
   TUTTOCAMPO WIDGET COMPONENTS - NO BACKGROUND
   ======================================== */

.tuttocampo-widget-container {
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
}

.tuttocampo-widget-header {
    background: transparent;
    padding: 0.75rem 1rem;
    border-bottom: none;
}

.tuttocampo-widget-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}

/* Margin bottom only for right column (Classifica) */
.col-md-6:last-child .tuttocampo-widget-title {
    margin-bottom: 10px;
}

.tuttocampo-widget-title .widget-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.tuttocampo-widget-title .widget-icon svg {
    width: 100%;
    height: 100%;
    color: #16a34a;
}

.tuttocampo-widget-iframe-wrapper {
    background: transparent;
    min-height: 400px;
    margin-top: -20px !important;
}

.tuttocampo-widget-iframe {
    border: none;
    display: block;
}

.tuttocampo-widget-error {
    padding: 2rem;
    text-align: center;
    color: #dc2626;
    background: #fee;
    border-radius: 8px;
}

.tuttocampo-widget-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Desktop Large (> 1200px) - More space for larger screens */
@media (min-width: 1200px) {
    .dilettanti-tabs-nav {
        gap: 0.5rem;
    }
    
    .dilettanti-tab-button {
        padding: 0.55rem 0rem;
        font-size: 0.8125rem;
    }
}

/* Desktop Medium (992px - 1199px) - Balanced spacing */
@media (min-width: 992px) and (max-width: 1199px) {
    .dilettanti-tabs-nav {
        gap: 0.4rem;
    }
    
    .dilettanti-tab-button {
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Tablet (768px - 991px) - Compact for smaller screens */
@media (min-width: 768px) and (max-width: 991px) {
    .dilettanti-tabs-nav {
        gap: 0.3rem;
    }
    
    .dilettanti-tab-button {
        padding: 0.45rem 0.35rem;
        font-size: 0.7rem;
    }
}

/* Mobile (< 768px) - Custom Grid Layout */
@media (max-width: 767px) {
    .dilettanti-tabs-nav {
        justify-content: flex-start;
        padding: 0;
        gap: 0.5rem;
        flex-wrap: wrap; /* Mobile: wrap to grid */
        display: flex;
        width: 100%;
    }
    
    /* Reset desktop flex properties for mobile */
    .dilettanti-tab-item {
        flex: 0 0 auto; /* Reset flex for mobile grid */
    }
    
    /* Half width for all categories including Eccellenza A */
    .dilettanti-tab-item.dilettanti-tab-full-width,
    .dilettanti-tab-item.dilettanti-tab-half-width {
        flex: 0 0 calc(50% - 0.25rem);
        width: calc(50% - 0.25rem);
    }
    
    .dilettanti-tab-button {
        width: 100%;
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
        text-align: center;
        font-weight: 600;
        display: block;
    }
    
    /* Ensure button fills the container */
    .dilettanti-tab-item .dilettanti-tab-button {
        min-height: 44px; /* Touch target size */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .tuttocampo-widget-title {
        font-size: 0.9375rem;
    }
    
    .widget-column-wrapper {
        margin-bottom: 1rem;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 479px) {
    .dilettanti-tabs-nav {
        gap: 0.4rem;
    }
    
    /* All items have same width on small mobile */
    .dilettanti-tab-item.dilettanti-tab-full-width,
    .dilettanti-tab-item.dilettanti-tab-half-width {
        flex: 0 0 calc(50% - 0.2rem);
        width: calc(50% - 0.2rem);
    }
    
    .dilettanti-tab-button {
        padding: 0.55rem 0.4rem;
        font-size: 0.7rem;
        min-height: 42px;
    }
    
    .tuttocampo-widget-header {
        padding: 0.625rem 0.875rem;
    }
    
    .tuttocampo-widget-title {
        font-size: 0.875rem;
        gap: 0.5rem;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .dilettanti-tabs-container,
    .tuttocampo-widget-iframe-wrapper {
        page-break-inside: avoid;
    }
    
    .dilettanti-tab-button:not(.active) {
        display: none;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus visible for keyboard navigation */
.dilettanti-tab-button:focus-visible {
    outline: 2px solid #16a34a;
    outline-offset: -2px;
    z-index: 1;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .dilettanti-tab-button,
    .tuttocampo-widget-container,
    .widgets-loading-overlay {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .dilettanti-tab-button {
        border: 2px solid currentColor;
    }
    
    .dilettanti-tab-button.active {
        background: #16a34a;
        color: #fff;
    }
}

/* ========================================
   DARK MODE SUPPORT - SIMPLIFIED
   ======================================== */

@media (prefers-color-scheme: dark) {
    .dilettanti-tabs-nav {
        background: transparent;
    }
    
    .dilettanti-tab-button {
        background: #374151;
        color: #d1d5db;
        border-color: #4b5563;
    }
    
    .dilettanti-tab-button:hover {
        background: #4b5563;
        color: #f3f4f6;
    }
    
    .dilettanti-tab-button.active {
        background: #16a34a;
        color: #fff;
    }
    
    .tuttocampo-widget-container {
        background: transparent;
        border: none;
    }
    
    .tuttocampo-widget-header {
        background: transparent;
        border: none;
    }
    
    .tuttocampo-widget-title {
        color: #000;
    }
    
    .tuttocampo-widget-iframe-wrapper {
        background: transparent;
    }
}
