/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Mobile viewport fixes for background coverage */
html,
body {
    width: 100%;
    min-width: 100vw;
}

/* Ensure the body gradient background covers full viewport */
body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent horizontal scroll issues on mobile */
* {
    box-sizing: border-box;
}

/* Main content container width fixes */
main {
    width: 100%;
    max-width: 100vw;
}

/* Mobile-specific overflow prevention */
@media (max-width: 768px) {
    /* Prevent any element from exceeding viewport width */
    .w-32 {
        max-width: 30vw !important;
    }

    /* Enable horizontal scrolling for tables on mobile */
    .overflow-x-auto {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent form elements from overflowing */
    select,
    input {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Ensure sidebar doesn't affect main content width */
    body.sidebar-open {
        overflow-x: hidden;
    }

    /* Force full width coverage for gradient background */
    body {
        min-width: 100vw !important;
        width: 100vw !important;
    }

    /* Keep table cells properly sized */
    table .whitespace-nowrap {
        white-space: nowrap !important;
    }
}

/* Home page specific mobile fixes */
@media (max-width: 768px) {
    /* Fix home page grid layouts for mobile */
    .grid.grid-cols-2.lg\\:grid-cols-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }

    .grid.grid-cols-2.lg\\:grid-cols-3 {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }

    .grid.lg\\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Fix flex layouts with potential overflow */
    .flex.items-start.gap-4 {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .flex.items-center.min-w-0 {
        min-width: auto !important;
        flex-shrink: 1 !important;
    }

    /* Prevent text overflow in match details */
    .text-sm.text-gray-600 {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Fix quick actions grid spacing */
    .grid.grid-cols-2.lg\\:grid-cols-3.gap-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem !important;
    }

    /* Ensure match cards don't overflow */
    .group.relative.border {
        width: 100%;
        overflow: hidden;
    }

    /* Fix nested flex layouts in match details */
    .flex.justify-between.items-start {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    /* Adjust match detail sections for mobile */
    .flex.items-start.gap-4.text-sm {
        flex-direction: column !important;
        gap: 0.25rem !important;
    }

    /* Fix time/location/opponent layout - exclude gamedays table */
    .flex.items-center.min-w-0.w-20.flex-shrink-0:not(.gamedays-table *),
    .flex.items-center.min-w-0.flex-1:not(.gamedays-table *),
    .flex.items-start.min-w-0.flex-1:not(.gamedays-table *) {
        width: 100% !important;
        min-width: 100% !important;
        flex-shrink: 0 !important;
    }

    /* Ensure proper spacing in week view */
    .flex.items-start.space-x-3 {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Fix callups indicator spacing */
    .flex.space-x-2 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Custom animations and visual enhancements */

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

/* Development Environment Styles */
.dev-border {
    border: 2px dashed #f97316 !important;
    border-radius: 4px;
}

.dev-highlight {
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
    border-radius: 4px;
}

.dev-watermark {
    position: relative;
}

.dev-watermark::before {
    content: "DEV";
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(249, 115, 22, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
}

/* Development banner animations */
@keyframes dev-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

/* Development grid overlay (optional debugging tool) */
.dev-grid {
    background-image:
        linear-gradient(rgba(249, 115, 22, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(249, 115, 22, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

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

/* Glass morphism effect */
.glass {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Staggered animation delays */
.animate-delay-100 {
    animation-delay: 100ms;
}

.animate-delay-200 {
    animation-delay: 200ms;
}

.animate-delay-300 {
    animation-delay: 300ms;
}

.animate-delay-400 {
    animation-delay: 400ms;
}

/* Shimmer effect for loading states */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #3b82f6, #6366f1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #2563eb, #4f46e5);
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced button hover effects */
.btn-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

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

/* Smooth transitions for all interactive elements */
* {
    transition-property:
        color, background-color, border-color, text-decoration-color, fill,
        stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* Focus states for accessibility */
.focus-ring:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Responsive grid improvements */
@media (max-width: 768px) {
    .mobile-stack {
        grid-template-columns: 1fr;
    }
}

/* Enhanced 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);
}

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

/* Gradient backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Loading states */
.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Utility classes for enhanced UX */
.transform-gpu {
    transform: translate3d(0, 0, 0);
}

.will-change-transform {
    will-change: transform;
}

/* Sidebar Navigation Styles */
.sidebar-nav-item {
    position: relative;
    overflow: hidden;
}

.sidebar-nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.sidebar-nav-item:hover::before,
.sidebar-nav-item.active::before {
    transform: scaleY(1);
}

.sidebar-nav-item.active {
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.1),
        rgba(99, 102, 241, 0.1)
    );
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Mobile sidebar styles */
@media (max-width: 768px) {
    .sidebar-hidden {
        transform: translateX(-100%);
    }

    .sidebar-mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
    }
}

/* Sidebar animation enhancements */
.sidebar-item-enter {
    animation: slideInLeft 0.3s ease-out;
}

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

/* Enhanced hover effects for sidebar icons */
.sidebar-icon {
    transition: all 0.2s ease;
}

.sidebar-nav-item:hover .sidebar-icon {
    transform: scale(1.1);
}

/* Smooth scrollbar for sidebar */
.sidebar-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 2px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}
