/**
 * Match Single Page Styles
 * Estilos específicos para a página single-aps_jogo.php
 * 
 * @package SuperPortistas
 * @since 2.0.0
 */

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

/* Sticky Header */
#match-header-sticky {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
    transition: box-shadow 0.3s ease;
}

#match-header-sticky.shadow-lg {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Scroll Margin for Sections */
section[id$="-section"] {
    scroll-margin-top: 100px;
    }
    
/* Section Spacing */
.space-y-6 > * + * {
    margin-top: 1.5rem;
}

/* Premium Card Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bg-gradient-to-br {
    animation: fadeInUp 0.6s ease-out;
}

/* Pulse Animation for Live Elements */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}
    50% {
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Loading States */
.htmx-indicator {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Chat Scrollbar */
#match-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

#match-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#match-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#match-chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

#match-chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.7);
}

/* Premium Match Tabs Styles - Design System Super Portistas */
.match-tabs-premium-wrapper {
    position: relative;
    z-index: 20;
}

/* Background pattern animation */
@keyframes float-tabs {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.match-tabs-pattern {
    animation: float-tabs 8s ease-in-out infinite;
}

.match-tabs-premium-navigation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

/* When many tabs (e.g. 6+), allow horizontal scroll on small screens */
@media (max-width: 768px) {
    .match-tabs-premium-navigation {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 4px;
        gap: 0.5rem;
    }
    .match-tabs-premium-navigation .match-tab-premium-button {
        flex: 0 0 auto;
        min-width: 80px;
    }
}

.match-tab-premium-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    outline: none;
    min-height: 100px;
}

.match-tab-premium-button:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    ring: 4px;
    ring-color: rgba(99, 102, 241, 0.3);
}

.match-tab-premium-button:hover:not(.match-tab-premium-active) {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: #cbd5e1;
    color: #475569;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.match-tab-premium-button.match-tab-premium-active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border-color: #6366f1;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4), 0 4px 8px rgba(99, 102, 241, 0.2);
    transform: translateY(-3px) scale(1.05);
}

.match-tab-icon-wrapper {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.match-tab-premium-active .match-tab-icon-wrapper {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.match-tab-icon {
    width: 1.5rem;
    height: 1.5rem;
    transition: all 0.3s ease;
    color: currentColor;
}

.match-tab-premium-button:hover .match-tab-icon {
    transform: scale(1.1);
}

.match-tab-premium-active .match-tab-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.match-tab-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.3s ease;
    text-align: center;
}

.match-tab-indicator {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.match-tab-premium-button.match-tab-premium-live {
    animation: pulse-glow-tab-premium 2s ease-in-out infinite;
}

@keyframes pulse-glow-tab-premium {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4), 0 4px 8px rgba(239, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 8px 24px rgba(239, 68, 68, 0.6), 0 4px 12px rgba(239, 68, 68, 0.3);
    }
}

.match-tab-premium-button.match-tab-premium-inactive {
    background: white;
    color: #6b7280;
    border-color: #e5e7eb;
}

.match-tabs-content {
    position: relative;
    min-height: 400px;
    animation: fadeIn 0.4s ease-out;
}

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

/* Loading State */
.match-tabs-content .loading-overlay {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Smooth scroll behavior for tabs */
.match-tabs-premium-wrapper {
    scroll-margin-top: 80px;
}

/* Desktop: Show full premium design */
@media (min-width: 769px) {
    .match-tabs-premium-wrapper {
        margin-bottom: 2rem;
    }
    
    .match-tabs-premium-navigation {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

/* Alpine.js x-cloak - Hide elements until Alpine is ready */
[x-cloak] {
    display: none !important;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #match-header-sticky .max-w-7xl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    section[id$="-section"] {
        scroll-margin-top: 80px;
    }
    
    /* Premium Tabs Mobile - Fixed at top */
    .match-tabs-premium-wrapper {
        position: sticky;
        top: 80px;
        z-index: 30;
        margin: 0 -1rem;
        padding: 0 1rem;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0.98), rgba(238, 242, 255, 0.98));
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(226, 232, 240, 0.5);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        padding-top: 1rem;
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .match-tabs-premium-wrapper .bg-gradient-to-br {
        padding: 1rem;
        margin-bottom: 0;
        box-shadow: none;
        border: none;
    }
    
    .match-tabs-premium-wrapper .absolute.top-0.right-0 {
        display: none; /* Hide pattern on mobile */
    }
    
    .match-tabs-premium-wrapper .flex.items-center.mb-6 {
        display: none; /* Hide header on mobile */
    }
    
    .match-tabs-premium-navigation {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    
    .match-tab-premium-button {
        padding: 0.75rem 0.5rem;
        min-height: 80px;
        gap: 0.375rem;
    }
    
    .match-tab-icon-wrapper {
        width: 2rem;
        height: 2rem;
    }
    
    .match-tab-icon {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .match-tab-label {
        font-size: 0.6875rem;
    }
    
    /* Better spacing on mobile */
    .match-tabs-content {
        min-height: 300px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .match-tabs-premium-wrapper {
        top: 70px;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .match-tabs-premium-navigation {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 0.375rem;
    }
    
    .match-tab-premium-button {
        padding: 0.625rem 0.375rem;
        min-height: 70px;
        gap: 0.25rem;
    }
    
    .match-tab-icon-wrapper {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .match-tab-icon {
        width: 1rem;
        height: 1rem;
    }
    
    .match-tab-label {
        font-size: 0.625rem;
        line-height: 1.2;
    }
}

/* Tab Estatísticas: Accordions */
.match-stats-accordions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.match-stats-accordion-item {
    border: 1px solid rgba(229, 231, 235, 1);
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.match-stats-accordion-heading {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.match-stats-accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    text-align: left;
    color: rgba(17, 24, 39, 1);
    background: rgba(249, 250, 251, 1);
    border: none;
    cursor: pointer;
    font: inherit;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.match-stats-accordion-trigger:hover {
    background: rgba(243, 244, 246, 1);
    color: rgba(55, 65, 81, 1);
}

.match-stats-accordion-trigger:focus {
    outline: 2px solid rgba(99, 102, 241, 0.5);
    outline-offset: 2px;
}

.match-stats-accordion-chevron {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.match-stats-accordion-chevron-open {
    transform: rotate(180deg);
}

.match-stats-accordion-panel {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(229, 231, 235, 1);
    background: #fff;
}

.match-stats-accordion-panel > * + * {
    margin-top: 1rem;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-pulse,
    .animate-ping,
    .animate-spin {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .match-tab-premium-button {
        border-width: 3px;
    }
    
    .match-tab-premium-button.match-tab-premium-active {
        border-width: 4px;
    }
}

/* Print Styles */
@media print {
    #match-header-sticky {
        position: static;
    }
    
    .no-print {
        display: none;
    }
}
