/**
 * DNS Propagation Checker - Custom Styles v3.0
 * G Tech Group
 * Design professionale con footer avanzato
 */

/* ==================================
   VARIABILI CSS CUSTOM PROPERTIES
   ================================== */
:root {
    /* Colori primari - G Tech Group Brand */
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --primary-50: #eff6ff;
    
    /* Colori secondari */
    --secondary-color: #1e40af;
    
    /* Colori di stato */
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    
    /* Colori neutri */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --black: #000000;
    
    /* Colori per le sezioni del footer */
    --footer-blue: #3b82f6;
    --footer-green: #10b981;
    --footer-purple: #9333ea;
    --footer-yellow: #f59e0b;
    
    /* Ombre */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transizioni */
    --transition-fast: 0.15s;
    --transition-base: 0.3s;
    --transition-slow: 0.5s;
    
    /* Border radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;
}

/* ==================================
   RESET E BASE
   ================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    --tw-gradient-from-position: ;
    --tw-gradient-to-position: ;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.6;
}

/* ==================================
   TYPOGRAPHY
   ================================== */
.gradient-text {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    font-weight: 700;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    line-height: 1.2;
}

/* ==================================
   ANIMAZIONI GLOBALI
   ================================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes fadeInOnly {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(1.1); }
    20%, 40% { transform: scale(0.95); }
}

@keyframes slideInLeft {
    from { 
        opacity: 0; 
        transform: translateX(-30px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes slideInRight {
    from { 
        opacity: 0; 
        transform: translateX(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==================================
   UTILITÀ ANIMAZIONI
   ================================== */
.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.6s ease-out;
}

.animate-slide-right {
    animation: slideInRight 0.6s ease-out;
}

.animate-fade-up {
    animation: fadeInUp 0.8s ease-out;
}

/* ==================================
   LAYOUT E GRID
   ================================== */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
    }

    .sm\:block {
        display: block;
    }

    .sm\:flex-row {
        flex-direction: row;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
    
    .xl\:col-span-3 {
        grid-column: span 3 / span 3;
    }
    
    .xl\:col-span-2 {
        grid-column: span 2 / span 2;
    }

    .xl\:grid-cols-5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* ==================================
   HEADER
   ================================== */
header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--gray-200);
    -webkit-transition: all var(--transition-base) ease;
    -o-transition: all var(--transition-base) ease;
    transition: all var(--transition-base) ease;
}

header:hover {
    box-shadow: var(--shadow-md);
}

#mobileMenu {
    background-color: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* ==================================
   HERO SECTION
   ================================== */
.bg-gradient-to-r {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-50) 0%, #e0e7ff 100%);
}

.bg-gradient-to-r::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        45deg, 
        transparent 30%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 70%
    );
    animation: shimmer 3s infinite;
}

/* ==================================
   CARDS
   ================================== */
.card-hover {
    background: white;
    border: 1px solid transparent;
    border-radius: var(--radius-xl);
    -webkit-transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
    -o-transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
    transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.card-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: -webkit-gradient(linear, left top, right top, from(var(--primary-color)), to(var(--primary-light)));
    background: -o-linear-gradient(left, var(--primary-color), var(--primary-light));
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    -webkit-transform: translateX(-100%);
    -ms-transform: translateX(-100%);
    transform: translateX(-100%);
    -webkit-transition: -webkit-transform var(--transition-slow) ease;
    transition: -webkit-transform var(--transition-slow) ease;
    -o-transition: transform var(--transition-slow) ease;
    transition: transform var(--transition-slow) ease;
    transition: transform var(--transition-slow) ease, -webkit-transform var(--transition-slow) ease;
}

.card-hover:hover {
    -webkit-transform: translateY(-2px);
    -ms-transform: translateY(-2px);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    border-color: var(--gray-200);
}

.card-hover:hover::before {
    -webkit-transform: translateX(0);
    -ms-transform: translateX(0);
    transform: translateX(0);
}

/* Summary Cards Special Effects */
#summaryCards .card-hover {
    border-left: 4px solid transparent;
    transition: all var(--transition-base) ease;
}

#summaryCards .card-hover:hover {
    border-left-color: var(--primary-color);
}

/* ==================================
   FORM ELEMENTS
   ================================== */
.input-modern {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast) ease;
    font-size: 16px;
}

.input-modern:hover:not(:focus) {
    border-color: var(--gray-300);
}

.input-modern:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Checkbox personalizzati */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background-color: #fff;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast) ease;
    flex-shrink: 0;
}

input[type="checkbox"]:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-50);
}

input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4.5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    outline: none;
}

/* ==================================
   BUTTONS
   ================================== */
button {
    transition: all var(--transition-base) ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: none;
    font-family: inherit;
}

/* Ripple Effect migliorato */
.btn-primary {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width var(--transition-slow), height var(--transition-slow);
    z-index: -1;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

button:active:not(:disabled) {
    transform: translateY(0) scale(1);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Support buttons styling migliorato */
.bg-green-500 { background-color: var(--success-color); }
.bg-green-500:hover { background-color: #059669; }

.bg-indigo-600 { background-color: #4f46e5; }
.bg-indigo-600:hover { background-color: #4338ca; }

.bg-purple-600 { background-color: #9333ea; }
.bg-purple-600:hover { background-color: #7c3aed; }

/* WhatsApp button effect */
button:has(.fa-whatsapp) {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
}

button:has(.fa-whatsapp):hover {
    background: linear-gradient(135deg, #128c7e 0%, #075e54 100%);
    transform: translateY(-2px) scale(1.02);
}

/* ==================================
   LOADING STATE
   ================================== */
.loading {
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    position: relative;
    min-height: 200px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
}

.loading.active {
    display: flex;
}

#progressBar {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    position: relative;
    overflow: hidden;
}

#progressBar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

/* ==================================
   MAP SECTION
   ================================== */
#map {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-lg);
    position: relative;
    height: 350px;
    min-height: 280px;
    max-height: 600px;
}

#map::before {
    content: 'Caricamento mappa...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--gray-500);
    font-size: 0.875rem;
    pointer-events: none;
}

/* Leaflet popup custom styling */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-xl) !important;
    padding: 4px !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-content {
    margin: 8px 12px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.leaflet-popup-tip {
    box-shadow: var(--shadow-sm) !important;
}

.leaflet-tooltip {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 0.75rem !important;
    border-radius: var(--radius-md) !important;
    padding: 4px 8px !important;
}

/* ==================================
   ALERTS
   ================================== */
#propagationAlert > div {
    border-width: 2px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

#propagationAlert > div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
    opacity: 0.5;
}

#propagationAlert .bg-red-50 {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

#propagationAlert .bg-yellow-50 {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

#propagationAlert .bg-blue-50 {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

#propagationAlert details summary {
    outline: none;
    cursor: pointer;
}

#propagationAlert details[open] summary {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* ==================================
   TABLE STYLES
   ================================== */
table {
    border-collapse: collapse;
    width: 100%;
}

thead {
    background: linear-gradient(to bottom, var(--gray-50), var(--gray-100));
}

thead th {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
}

#resultsTableBody tr {
    transition: all var(--transition-fast) ease;
    animation: fadeInOnly 0.5s ease-out forwards;
    border-bottom: 1px solid var(--gray-200);
}

#resultsTableBody tr:hover {
    background-color: rgba(59, 130, 246, 0.06) !important;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.08);
}

/* Status Badges */
.bg-green-100,
.bg-red-100,
.bg-yellow-100 {
    animation: fadeIn 0.3s ease-out;
    transition: all var(--transition-fast) ease;
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border-radius: var(--radius-full);
    padding: 0.375rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.bg-green-100 {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.bg-red-100 {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.bg-yellow-100 {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* ==================================
   FOOTER PROFESSIONALE
   ================================== */
footer {
    background: linear-gradient(to bottom, #111827, #000000) !important;
    color: white;
    position: relative;
    overflow: hidden;
}

/* Footer logo */
footer img {
    opacity: 0.9;
    transition: opacity var(--transition-base) ease;
}

footer img:hover {
    opacity: 1;
}

/* Footer text hierarchy */
footer .text-gray-400 {
    color: #9ca3af !important;
}

footer .text-gray-500 {
    color: #9ca3af !important;
}

footer .text-gray-600 {
    color: #6b7280 !important;
}

/* Social Media Icons nel footer */
footer .bg-gray-800 {
    background-color: rgba(55, 65, 81, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-base) ease;
}

footer a[href*="facebook"]:hover {
    background-color: #1877f2 !important;
}

footer a[href*="linkedin"]:hover {
    background-color: #0077b5 !important;
}

footer a[href*="twitter"]:hover {
    background-color: #1da1f2 !important;
}

footer a[href*="whatsapp"]:hover {
    background-color: #25d366 !important;
}

/* Footer section icons colors */
footer .text-blue-500 { color: var(--footer-blue) !important; }
footer .text-green-500 { color: var(--footer-green) !important; }
footer .text-purple-500 { color: var(--footer-purple) !important; }
footer .text-yellow-500 { color: var(--footer-yellow) !important; }

/* Footer links */
footer a {
    color: white;
    transition: all var(--transition-fast) ease;
    text-decoration: none;
}

footer a.text-gray-400 {
    color: #9ca3af !important;
}

footer a.text-gray-400:hover {
    color: white !important;
}

footer a:hover:not([aria-label]) {
    transform: translateX(3px);
}

/* Footer text */
footer p,
footer span,
footer address {
    color: white;
}

footer .text-yellow-400 {
    color: #facc15 !important;
}

/* Footer hover con icone colorate */
footer .group:hover .group-hover\:text-green-400 {
    color: #34d399 !important;
}

footer .group:hover .group-hover\:text-purple-400 {
    color: #a78bfa !important;
}

/* Made with love animation */
.fa-heart {
    display: inline-block;
    color: #ef4444;
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* ==================================
   FAQ SECTION
   ================================== */
details {
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base) ease;
}

details:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-sm);
}

details[open] {
    box-shadow: var(--shadow-md);
}

details summary {
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-base) ease;
    padding: 1rem;
    border-radius: var(--radius-lg);
}

details summary:hover {
    background-color: var(--gray-50);
}

details summary::-webkit-details-marker {
    display: none;
}

details summary .fa-chevron-down {
    transition: transform var(--transition-base) ease;
}

details[open] summary .fa-chevron-down {
    transform: rotate(180deg);
}

/* ==================================
   TOAST NOTIFICATIONS
   ================================== */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: var(--shadow-xl);
    transform: translateY(100px);
    transition: transform var(--transition-base) ease-out;
    z-index: 1001;
    max-width: 350px;
}

.toast.show {
    transform: translateY(0);
}

/* ==================================
   SCROLLBAR PERSONALIZZATA
   ================================== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius-lg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius-lg);
    border: 2px solid var(--gray-100);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, var(--primary-dark), var(--secondary-color));
}

/* ==================================
   ACCESSIBILITY
   ================================== */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) 0;
    z-index: 1001;
}

.skip-to-content:focus {
    top: 0;
}

/* ==================================
   RESPONSIVE DESIGN
   ================================== */
/* Mobile First Approach */

/* Tablet (768px+) */
@media (min-width: 768px) {
    #map {
        height: 450px;
    }
    
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .md\:flex-row {
        flex-direction: row;
    }

    .md\:mb-0 {
        margin-bottom: 0;
    }

    .md\:flex {
        display: flex;
    }

    .md\:hidden {
        display: none;
    }

    .md\:h-10 {
        height: 2.5rem;
    }

    .md\:h-20 {
        height: 5rem;
    }

    .md\:p-10 {
        padding: 2.5rem;
    }

    .md\:py-12 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .md\:space-x-4 > * + * {
        margin-left: 1rem;
    }

    .md\:text-xl {
        font-size: 1.25rem;
        line-height: 1.75rem;
    }

    .md\:text-4xl {
        font-size: 2.25rem;
        line-height: 2.5rem;
    }

    .md\:w-auto {
        width: auto;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .lg\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .lg\:flex-row {
        flex-direction: row;
    }

    .lg\:gap-12 {
        gap: 3rem;
    }

    .lg\:justify-end {
        justify-content: flex-end;
    }

    .lg\:space-y-0 > * + * {
        margin-top: 0;
    }

    .lg\:text-2xl {
        font-size: 1.5rem;
        line-height: 2rem;
    }

    .lg\:text-left {
        text-align: left;
    }
}

/* Tablet (768-1024px) - Hide Provider column, compact padding, footer gap */
@media (min-width: 768px) and (max-width: 1024px) {
    #resultsTableBody td:nth-child(5),
    thead th:nth-child(5) {
        display: none;
    }

    thead th,
    #resultsTableBody td {
        padding: 0.5rem 0.75rem;
    }

    footer .grid {
        gap: 2rem 3rem;
    }
}

/* Wide Desktop (1280px+) */
@media (min-width: 1280px) {
    #map {
        height: 550px;
    }
}

/* Mobile optimizations */
@media (max-width: 640px) {
    /* Table mobile - hide Location and Provider columns */
    #resultsTableBody td:nth-child(4),
    thead th:nth-child(4),
    #resultsTableBody td:nth-child(5),
    thead th:nth-child(5) {
        display: none;
    }

    table {
        font-size: 0.813rem; /* Aumentato da 0.75rem per migliore leggibilità */
    }

    thead th {
        padding: 0.625rem; /* Aumentato per migliori touch targets */
        font-size: 0.688rem;
    }

    tbody td {
        padding: 0.75rem; /* Aumentato per migliori touch targets */
    }

    /* Status badge sticky su mobile */
    tbody td:first-child {
        position: -webkit-sticky;
        position: sticky;
        left: 0;
        background-color: inherit;
        z-index: 1;
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
    }

    /* Touch targets migliorati per mobile */
    button,
    a {
        min-height: 44px; /* iOS recommended minimum */
        min-width: 44px;
    }

    /* Input touch-friendly */
    input[type="text"],
    input[type="checkbox"],
    select {
        min-height: 44px;
        font-size: 16px; /* Previene zoom su iOS */
    }

    /* Footer mobile */
    footer .grid {
        gap: 2rem;
    }

    footer h4 {
        font-size: 1rem;
    }

    /* Migliora spaziatura per touch */
    .space-y-2 > * + * {
        margin-top: 0.75rem;
    }

    .space-y-3 > * + * {
        margin-top: 1rem;
    }
}

/* ==================================
   PRINT STYLES
   ================================== */
@media print {
    header, 
    footer, 
    button,
    .no-print,
    #actionButtons,
    #chat-init {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .bg-white {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    #map {
        height: 400px !important;
        break-inside: avoid;
    }
    
    /* Assicura colori per stampa */
    * {
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==================================
   UTILITIES CLASSES
   ================================== */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }

/* Transitions */
.transition-all {
    transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-colors {
    transition: background-color var(--transition-base) ease, 
                border-color var(--transition-base) ease, 
                color var(--transition-base) ease;
}

.transition-transform {
    transition: transform var(--transition-base) ease;
}

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }

/* Overflow scroll indicator */
.overflow-x-auto {
    overflow-x: auto;
    position: relative;
}

.overflow-x-auto::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    pointer-events: none;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.9));
    z-index: 2;
    transition: opacity 0.3s ease;
}

.overflow-x-auto.scrolled-end::after {
    opacity: 0;
}

/* ==================================
   PERFORMANCE OPTIMIZATIONS
   ================================== */
/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* GPU acceleration for animations */
.animate-spin,
.animate-pulse,
.card-hover,
button {
    will-change: transform;
}

/* ==================================
   DARK MODE
   Activated via html.dark class (set by JS based on toggle or system preference)
   ================================== */
html.dark {
    --primary-color: #60a5fa;
    --primary-dark: #3b82f6;
    --primary-light: #93c5fd;
    --primary-50: #1e293b;
    --primary-100: #1e3a5f;
    --secondary-color: #93c5fd;
    --secondary-dark: #60a5fa;
    --success-color: #34d399;
    --error-color: #f87171;
    --warning-color: #fbbf24;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #94a3b8;
    --gray-500: #cbd5e1;
    --gray-600: #e2e8f0;
    --gray-700: #f1f5f9;
    --gray-800: #f8fafc;
    --gray-900: #ffffff;
    --black: #0f172a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);

    body {
        background: #0f172a;
        color: #e2e8f0;
    }

    header {
        background-color: rgba(15, 23, 42, 0.95);
        border-bottom-color: #1e293b;
    }

    .bg-gradient-to-r {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }

    .card-hover,
    .bg-white {
        background: #1e293b !important;
        border-color: #334155;
    }

    .input-modern {
        background: #0f172a;
        border-color: #334155;
        color: #e2e8f0;
    }

    .input-modern:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
    }

    .input-modern::placeholder {
        color: #64748b;
    }

    .bg-gray-50 {
        background-color: #0f172a !important;
    }

    .text-gray-900 { color: #f1f5f9 !important; }
    .text-gray-800 { color: #e2e8f0 !important; }
    .text-gray-700 { color: #cbd5e1 !important; }
    .text-gray-600 { color: #94a3b8 !important; }
    .text-gray-500 { color: #64748b !important; }

    /* Table */
    thead {
        background: linear-gradient(to bottom, #1e293b, #0f172a);
    }

    #resultsTableBody tr {
        border-bottom-color: #334155;
    }

    #resultsTableBody tr:hover {
        background-color: rgba(96, 165, 250, 0.05) !important;
    }

    /* Map */
    #map {
        background: #1e293b;
        border-color: #334155;
    }

    #map::before {
        color: #64748b;
    }

    /* FAQ */
    details:hover {
        border-color: #334155;
    }

    details summary:hover {
        background-color: #1e293b;
    }

    /* Scrollbar */
    ::-webkit-scrollbar-track {
        background: #1e293b;
    }

    ::-webkit-scrollbar-thumb {
        background: linear-gradient(to bottom, #3b82f6, #2563eb);
        border-color: #1e293b;
    }

    /* Footer */
    footer {
        background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
        border-top: 1px solid #334155;
    }

    footer .text-gray-400 {
        color: #94a3b8 !important;
    }

    footer .text-gray-500 {
        color: #94a3b8 !important;
    }

    footer .text-gray-600 {
        color: #64748b !important;
    }

    footer a.text-gray-400 {
        color: #94a3b8 !important;
    }

    footer a.text-gray-400:hover {
        color: #fff !important;
    }

    footer .bg-gray-800 {
        background-color: rgba(30, 41, 59, 0.6) !important;
        border-color: rgba(255, 255, 255, 0.08);
    }

    footer .border-gray-800,
    footer .border-t,
    footer .border-b {
        border-color: #334155;
    }

    /* Checkbox */
    input[type="checkbox"] {
        background-color: #0f172a;
        border-color: #475569;
    }

    input[type="checkbox"]:hover {
        border-color: #60a5fa;
        background-color: #1e293b;
    }

    input[type="checkbox"]:checked {
        background-color: #3b82f6;
        border-color: #3b82f6;
    }

    /* Scroll indicator */
    .overflow-x-auto::after {
        background: linear-gradient(to right, transparent, rgba(30, 41, 59, 0.9));
    }

    /* Fix Tailwind utility overrides */
    .border-gray-100 { border-color: #1e293b !important; }
    .border-gray-200 { border-color: #334155 !important; }
    .bg-gray-100 { background-color: #1e293b !important; }
    .divide-gray-200 > * + * { border-color: #334155; }

    /* Status/alert background overrides for dark mode */
    .bg-green-100 {
        background-color: rgba(34, 197, 94, 0.15) !important;
        border-color: rgba(34, 197, 94, 0.3) !important;
    }
    .bg-red-100 {
        background-color: rgba(239, 68, 68, 0.15) !important;
        border-color: rgba(239, 68, 68, 0.3) !important;
    }
    #propagationAlert .bg-red-50 {
        background: rgba(239, 68, 68, 0.1) !important;
    }
    #propagationAlert .bg-yellow-50 {
        background: rgba(234, 179, 8, 0.1) !important;
    }
    #propagationAlert .bg-blue-50 {
        background: rgba(59, 130, 246, 0.1) !important;
    }
}
