/* Stili personalizzati per la web app */

/* Schema colori del template */
:root {
    /* Colore Principale - Blue */
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-500: #3b82f6;
    --color-primary-600: #2563eb;
    --color-primary-700: #1d4ed8;

    /* Colore Secondario - Red */
    --color-secondary-50: #fef2f2;
    --color-secondary-100: #fee2e2;
    --color-secondary-500: #ef4444;
    --color-secondary-600: #dc2626;
    --color-secondary-700: #b91c1c;
}

/* Ultra Modern Navigation Links */
.nav-link-ultra-modern {
    @apply relative flex items-center px-4 py-2.5 text-gray-600 hover:text-primary-600 font-medium transition-all duration-500 rounded-xl;
    position: relative;
    overflow: hidden;
}

.nav-link-ultra-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.08), transparent);
    transition: left 0.6s ease-out;
}

.nav-link-ultra-modern:hover::before {
    left: 100%;
}

.nav-link-ultra-modern:hover {
    @apply text-primary-700 transform scale-105;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.nav-link-ultra-modern.nav-ultra-active {
    @apply text-primary-600 bg-white/70;
    box-shadow: 0 2px 20px rgba(59, 130, 246, 0.15);
    backdrop-filter: blur(8px);
}

/* Stili personalizzati per la tabella degli esiti di gara */
.esiti-table-loading {
    pointer-events: none;
    user-select: none;
}

.esiti-table-spinner {
    animation: spin 1s linear infinite;
}

.esiti-table-spinner-reverse {
    animation: spin-reverse 0.8s linear infinite;
}

@keyframes spin-reverse {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

/* Miglioramenti per l'overlay di caricamento */
.esiti-loading-overlay {
    backdrop-filter: blur(1px);
}

/* Animazione pulse per il testo di caricamento */
.esiti-loading-text {
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Stili per i pulsanti dettagli */
.esiti-details-btn {
    position: relative;
    overflow: hidden;
}

.esiti-details-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.esitis-details-btn:hover::before {
    left: 100%;
}

.esiti-details-btn:active {
    transform: scale(0.98);
}

/* Effetti hover per i controlli della tabella */
.esiti-table button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.esiti-table button:disabled {
    transform: none;
    box-shadow: none;
}

/* Stili per la paginazione header compatta */
.esiti-pagination-header {
    border-radius: 8px;
    background: rgba(249, 250, 251, 0.8);
    backdrop-filter: blur(4px);
}

.esiti-pagination-compact button {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
}

.esiti-pagination-compact button:hover:not(:disabled) {
    background-color: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.esiti-pagination-compact .page-indicator {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.025em;
    min-width: 50px;
    text-align: center;
}

/* Transizione smooth per l'opacità della tabella */
.esiti-table-content {
    transition: opacity 0.3s ease-in-out, filter 0.3s ease-in-out;
}

.esiti-table-content.loading {
    filter: grayscale(0.3);
}

/* Responsive per paginazione header */
@media (max-width: 640px) {
    .esiti-pagination-header {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .esiti-pagination-compact {
        justify-content: center;
    }
}

.esiti-table-wrapper {
    @apply bg-white rounded-lg shadow-lg overflow-hidden;
}

.esiti-table-header {
    @apply bg-gray-50 border-b border-gray-200 p-4 sm:p-6;
}

.esiti-search-input {
    @apply block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-primary-500 focus:border-primary-500 text-sm transition-all duration-200;
}

.esiti-search-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.esiti-table-loading {
    @apply flex items-center text-sm text-gray-500;
}

.esiti-table-loading svg {
    @apply animate-spin -ml-1 mr-2 h-4 w-4;
}

/* Stili per le celle della tabella */
.esiti-table th {
    @apply px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100 transition-colors duration-150;
}

.esiti-table td {
    @apply px-4 py-4 text-sm transition-colors duration-150;
}

.esiti-table tbody tr {
    @apply hover:bg-gray-50 transition-colors duration-150;
}

.esiti-table tbody tr:hover {
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.1);
}

/* Stili per l'ordinamento */
.sort-header {
    @apply flex items-center;
}

.sort-icon {
    @apply ml-1 transition-colors duration-150;
}

.sort-icon.active {
    @apply text-primary-500;
}

/* Stili per la paginazione */
.pagination-button {
    @apply px-3 py-1 text-sm border border-gray-300 rounded transition-all duration-150;
}

.pagination-button:hover:not(:disabled) {
    @apply bg-gray-100 transform scale-105;
}

.pagination-button:disabled {
    @apply opacity-50 cursor-not-allowed;
}

.pagination-button.active {
    @apply bg-primary-500 text-white border-primary-500;
}

/* Stili per il modal */
.esiti-modal-overlay {
    @apply fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity duration-300;
}

.esiti-modal-content {
    @apply inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all duration-300 sm:my-8 sm:align-middle sm:max-w-4xl sm:w-full;
}

.esiti-modal-enter {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
}

.esiti-modal-enter-active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Animazioni per le transizioni */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

/* Responsive improvements */
@media (max-width: 640px) {
    .esiti-table-header {
        @apply p-4;
    }

    .esiti-table th,
    .esiti-table td {
        @apply px-2 py-3;
    }

    .pagination-button {
        @apply px-2 py-1 text-xs;
    }
}

/* Indicatori di caricamento */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Stili per stati vuoti */
.empty-state {
    @apply flex flex-col items-center py-8 text-gray-500;
}

.empty-state-icon {
    @apply text-4xl text-gray-300 mb-4;
}

.empty-state-title {
    @apply text-lg font-medium mb-2;
}

.empty-state-description {
    @apply text-sm;
}

/* Miglioramenti accessibilità */
.sr-only {
    @apply absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0;
    clip: rect(0, 0, 0, 0);
}

/* Focus styles migliorati */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    @apply outline-none ring-2 ring-primary-500 ring-offset-2;
}

/* Stili per i badge di stato */
.status-badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.status-badge.success {
    @apply bg-green-100 text-green-800;
}

.status-badge.warning {
    @apply bg-yellow-100 text-yellow-800;
}

.status-badge.error {
    @apply bg-red-100 text-red-800;
}

.status-badge.info {
    @apply bg-blue-100 text-blue-800;
}

.nav-link-ultra-modern.nav-ultra-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

/* Elementi con colore secondario (Red) */
.secondary-accent {
    @apply text-secondary-600;
}

.secondary-bg {
    @apply bg-secondary-500 text-white;
}

.secondary-border {
    @apply border-secondary-500;
}

.secondary-hover {
    @apply hover:bg-secondary-600;
}

/* Button secondario */
.btn-secondary {
    @apply inline-flex items-center px-4 py-2 text-sm font-medium rounded-md transition-colors;
    @apply bg-secondary-600 text-white hover:bg-secondary-700;
}

.btn-secondary-outline {
    @apply inline-flex items-center px-4 py-2 text-sm font-medium rounded-md transition-colors;
    @apply border border-secondary-600 text-secondary-600 bg-transparent hover:bg-secondary-50;
}

/* === SLIDER STYLES === */
.slider-container {
    @apply relative w-full;
}

.slider-container [x-transition] {
    transition-property: opacity, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Slide animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* Responsive text sizing */
@media (max-width: 640px) {
    .slider-container h2 {
        @apply text-3xl;
        line-height: 1.1;
    }

    .slider-container .text-xl {
        @apply text-lg;
    }

    .slider-container .text-lg {
        @apply text-base;
    }
}

/* Arrow button hover effects */
.slider-container button[class*="absolute"]:hover {
    transform: translateY(-50%) scale(1.1);
}

/* === CONTACT FORM STYLES === */
.contact-form-container {
    @apply bg-white border-b border-gray-200;
}

.contact-form {
    @apply bg-gray-50 rounded-lg shadow-sm;
}

.contact-form input[type="text"],
.contact-form input[type="tel"] {
    @apply w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm transition-colors;
    @apply focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="tel"]:focus {
    @apply ring-2 ring-primary-500 border-primary-500;
}

.contact-form label {
    @apply block text-sm font-medium text-gray-700;
}

.contact-form .submit-button {
    @apply inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md;
    @apply text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500;
    @apply disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200;
}

.contact-form .success-message {
    @apply flex items-center text-green-600 bg-green-50 px-4 py-2 rounded-md;
}

.contact-form .error-message {
    @apply flex items-center text-red-600 bg-red-50 px-4 py-2 rounded-md;
}

/* Responsive form adjustments */
@media (max-width: 1024px) {

    /* Tablet: 2 campi + 1 button sulla seconda riga */
    .contact-form .grid.lg\:grid-cols-5 {
        @apply grid-cols-2;
    }

    .contact-form .grid.lg\:grid-cols-5>div:nth-child(3),
    .contact-form .grid.lg\:grid-cols-5>div:nth-child(4),
    .contact-form .grid.lg\:grid-cols-5>div:nth-child(5) {
        @apply col-span-2;
    }

    .contact-form .grid.lg\:grid-cols-5>div:nth-child(5) {
        @apply col-span-1;
    }
}

@media (max-width: 768px) {

    /* Mobile: tutto in colonna singola */
    .contact-form .grid.lg\:grid-cols-5 {
        @apply grid-cols-1 gap-3;
    }

    .contact-form .grid.lg\:grid-cols-5>div {
        @apply col-span-1;
    }

    .contact-form button[type="submit"] {
        @apply w-full h-auto py-3;
    }
}

/* Form button alignment */
.contact-form .flex.items-end {
    @apply justify-stretch;
}

.contact-form button[type="submit"] {
    @apply min-h-[42px] text-sm;
}

/* Mobile Navigation Links */
.mobile-nav-link {
    @apply block w-full py-3 px-4 text-gray-700 hover:bg-gray-50/80 rounded-2xl transition-all duration-300;
    backdrop-filter: blur(4px);
}

.mobile-nav-link:hover {
    @apply transform translate-x-1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mobile-nav-link.mobile-nav-active {
    @apply bg-primary-50/80 text-primary-700;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.1);
}

/* Legacy Navigation Links (mantenuti per compatibilità) */
.nav-link {
    @apply text-gray-700 hover:text-primary-500 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200;
}

.nav-link.active {
    @apply text-primary-500 bg-primary-50;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Form focus styles */
input:focus,
textarea:focus,
select:focus {
    @apply outline-none ring-2 ring-primary-500 border-transparent;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    @apply bg-gray-100;
}

::-webkit-scrollbar-thumb {
    @apply bg-gray-400 rounded-lg;
}

::-webkit-scrollbar-thumb:hover {
    @apply bg-gray-500;
}

/* Hover effects */
.hover-lift {
    transition: transform 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Loading spinner */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Hero gradient animation */
.hero-gradient {
    background: linear-gradient(-45deg, #3b82f6, #2563eb, #1d4ed8, #1e40af);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Pulse animation for important elements */
.pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Custom card shadows */
.card-shadow {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease-in-out;
}

.card-shadow:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Typography improvements */
.text-gradient {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive video container */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    h1,
    h2,
    h3 {
        page-break-after: avoid;
    }
}

/* Accessibility improvements */
.focus-visible:focus-visible {
    @apply outline-none ring-2 ring-primary-500 ring-offset-2;
}

/* Skip to main content link */
.skip-link {
    @apply absolute left-0 top-0 bg-primary-600 text-white px-4 py-2 z-50 transform -translate-y-full;
    transition: transform 0.2s ease-in-out;
}

.skip-link:focus {
    @apply transform translate-y-0;
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here if needed */
}

/* Slider background optimization for SVG images */
.slider-container [style*="background-image"] {
    background-attachment: fixed;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: contrast(1.1) brightness(1.05);
    transform: scale(1.02);
}

.slider-container .absolute.inset-0 {
    will-change: background-image;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Smooth transitions for slider backgrounds */
.slider-container [x-show] {
    transition: opacity 0.7s ease-in-out, transform 0.7s ease-in-out;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nav-link {
        @apply border border-gray-400;
    }

    button,
    .btn {
        @apply border-2 border-current;
    }
}

/* Debug Panel Styles */
#debug-panel {
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(59, 130, 246, 0.3);
}

#debug-panel summary {
    list-style: none;
}

#debug-panel summary::-webkit-details-marker {
    display: none;
}

#debug-panel details[open] summary {
    @apply text-blue-300;
}

#debug-panel .debug-stat-card {
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

#debug-panel .debug-stat-card:hover {
    @apply bg-white/20 scale-105;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

#debug-panel .debug-query-card {
    transition: all 0.2s ease;
}

#debug-panel .debug-query-card:hover {
    @apply bg-black/50;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

/* Scrollbar per le query */
#debug-panel .query-scroll::-webkit-scrollbar {
    width: 6px;
}

#debug-panel .query-scroll::-webkit-scrollbar-track {
    @apply bg-slate-800/50 rounded;
}

#debug-panel .query-scroll::-webkit-scrollbar-thumb {
    @apply bg-slate-600 rounded;
}

#debug-panel .query-scroll::-webkit-scrollbar-thumb:hover {
    @apply bg-slate-500;
}

/* Console logs styling */
#debug-panel .debug-console-log {
    transition: all 0.2s ease;
}

#debug-panel .debug-console-log:hover {
    transform: translateX(2px);
}

/* Console log type specific styles */
#debug-panel .debug-console-log.bg-red-900\/30 {
    border-left-color: #ef4444;
}

#debug-panel .debug-console-log.bg-yellow-900\/30 {
    border-left-color: #f59e0b;
}

#debug-panel .debug-console-log.bg-blue-900\/30 {
    border-left-color: #3b82f6;
}

#debug-panel .debug-console-log.bg-slate-800\/30 {
    border-left-color: #64748b;
}