/* FPL Premium Tools - Mobile Optimization Styles */
/* This CSS file optimizes all FPL premium tools for mobile devices */

/* ==================== GLOBAL MOBILE STYLES ==================== */

/* Prevent horizontal scrolling on mobile */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    * {
        box-sizing: border-box !important;
    }
    
    /* Improve touch targets */
    button, a, .clickable, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    /* Better spacing for mobile */
    .main-content {
        padding: 10px !important;
        margin: 0 !important;
    }
    
    /* Optimize containers */
    .container, .predictor-container, .simulator-container, .ai-container, .analytics-container {
        padding: 15px !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        border-radius: 12px !important;
    }
    
    /* Headers optimization */
    h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
        margin-bottom: 10px !important;
    }
    
    h2 {
        font-size: 1.3rem !important;
        line-height: 1.3 !important;
        margin-bottom: 10px !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
    }
    
    /* Form elements */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    select,
    textarea {
        width: 100% !important;
        padding: 12px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        border-radius: 8px !important;
        border: 2px solid #e9ecef !important;
        margin-bottom: 10px !important;
    }
    
    /* Buttons */
    button, .btn, .search-btn, .action-btn {
        width: 100% !important;
        padding: 12px 20px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        margin-bottom: 10px !important;
        cursor: pointer !important;
        display: block !important;
    }
    
    /* Cards and grids */
    .player-card, .tool-card, .feature-card {
        width: 100% !important;
        margin-bottom: 15px !important;
        padding: 15px !important;
    }
    
    .player-results, .tool-grid, .features-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* ==================== FPL PREMIUM HUB MOBILE ==================== */
@media (max-width: 768px) {
    /* Hero section */
    .premium-hero {
        padding: 20px 15px !important;
        min-height: auto !important;
    }
    
    .hero-content h1 {
        font-size: 1.8rem !important;
        margin-bottom: 10px !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 15px !important;
    }
    
    .hero-cta {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .cta-button {
        width: 100% !important;
        padding: 12px !important;
        font-size: 0.95rem !important;
    }
    
    /* Tool cards */
    .tools-showcase {
        padding: 20px 10px !important;
    }
    
    .tools-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 0 5px !important;
    }
    
    .tool-card {
        padding: 20px 15px !important;
        margin: 0 !important;
    }
    
    .tool-icon {
        font-size: 2rem !important;
        margin-bottom: 10px !important;
    }
    
    .tool-title {
        font-size: 1.2rem !important;
    }
    
    .tool-description {
        font-size: 0.9rem !important;
        margin-bottom: 15px !important;
    }
    
    /* Pricing section */
    .pricing-section {
        padding: 30px 10px !important;
    }
    
    .pricing-cards {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        max-width: 350px !important;
        margin: 0 auto !important;
    }
    
    .pricing-card {
        padding: 20px !important;
    }
    
    .price-amount {
        font-size: 2rem !important;
    }
}

/* ==================== FPL AI ASSISTANT MOBILE ==================== */
@media (max-width: 768px) {
    .ai-interface {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 10px !important;
    }
    
    .chat-panel, .team-panel {
        height: auto !important;
        min-height: 400px !important;
        max-height: 500px !important;
    }
    
    .chat-messages {
        height: 350px !important;
        padding: 10px !important;
    }
    
    .message-bubble {
        max-width: 85% !important;
        padding: 10px 12px !important;
        font-size: 0.9rem !important;
    }
    
    .chat-input-container {
        padding: 10px !important;
        gap: 10px !important;
    }
    
    .chat-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px !important;
    }
    
    .send-btn {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
    }
    
    .quick-actions {
        flex-wrap: wrap !important;
        gap: 5px !important;
        padding: 10px !important;
    }
    
    .quick-action-btn {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        flex: 1 1 calc(50% - 5px) !important;
    }
    
    /* Team panel mobile */
    .team-grid {
        display: flex !important;
        flex-direction: column !important;
        padding: 10px !important;
    }
    
    .position-row {
        margin-bottom: 15px !important;
    }
    
    .player-slot {
        width: 70px !important;
        height: 80px !important;
        font-size: 0.75rem !important;
        margin: 0 3px !important;
    }
    
    .player-name {
        font-size: 0.65rem !important;
    }
    
    .player-price {
        font-size: 0.6rem !important;
    }
}

/* ==================== TRANSFER SIMULATOR MOBILE ==================== */
@media (max-width: 768px) {
    .simulator-header {
        padding: 15px !important;
    }
    
    .budget-info {
        flex-direction: column !important;
        gap: 10px !important;
        margin-bottom: 15px !important;
    }
    
    .budget-item {
        width: 100% !important;
        padding: 10px !important;
        text-align: center !important;
    }
    
    .team-section {
        padding: 15px 10px !important;
    }
    
    .formation-selector {
        margin-bottom: 15px !important;
    }
    
    .formation-btn {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .pitch {
        padding: 15px 5px !important;
        min-height: auto !important;
    }
    
    .position-row {
        margin-bottom: 20px !important;
        padding: 0 5px !important;
    }
    
    .player-card-sim {
        width: 65px !important;
        padding: 5px !important;
        margin: 0 2px !important;
    }
    
    .player-photo {
        width: 35px !important;
        height: 35px !important;
    }
    
    .player-details {
        font-size: 0.65rem !important;
    }
    
    .player-stats {
        font-size: 0.6rem !important;
    }
    
    /* Transfer panels */
    .transfers-section {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 15px 10px !important;
    }
    
    .transfer-panel {
        padding: 15px !important;
    }
    
    .player-search {
        margin-bottom: 15px !important;
    }
    
    .search-filters {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .filter-group {
        width: 100% !important;
    }
    
    .player-list {
        max-height: 300px !important;
    }
    
    .player-item {
        padding: 10px !important;
        font-size: 0.85rem !important;
    }
}

/* ==================== PLAYER PREDICTOR MOBILE ==================== */
@media (max-width: 768px) {
    .predictor-header {
        padding: 20px 15px !important;
    }
    
    .predictor-header h1 {
        font-size: 1.5rem !important;
    }
    
    .predictor-header p {
        font-size: 0.9rem !important;
    }
    
    #live-indicator {
        flex-direction: column !important;
        gap: 10px !important;
        margin-top: 10px !important;
    }
    
    #live-indicator span {
        font-size: 0.8rem !important;
        padding: 4px 10px !important;
    }
    
    .search-panel {
        padding: 15px !important;
    }
    
    .search-controls {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .search-inputs {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .input-group {
        width: 100% !important;
    }
    
    .search-btn {
        width: 100% !important;
        padding: 12px !important;
    }
    
    /* Player results mobile */
    .player-results {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 0 10px !important;
    }
    
    .player-card {
        padding: 15px !important;
    }
    
    .prediction-score {
        top: 10px !important;
        right: 10px !important;
        padding: 6px 10px !important;
        font-size: 0.85rem !important;
    }
    
    .player-header {
        margin-bottom: 10px !important;
    }
    
    .player-info h3 {
        font-size: 1rem !important;
    }
    
    .player-meta {
        font-size: 0.8rem !important;
    }
    
    .player-price {
        font-size: 0.95rem !important;
        padding: 4px 8px !important;
    }
    
    .player-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .stat-box {
        padding: 6px !important;
    }
    
    .stat-value {
        font-size: 0.9rem !important;
    }
    
    .stat-label {
        font-size: 0.65rem !important;
    }
    
    /* Analysis tabs */
    .analysis-tabs {
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 5px !important;
        padding-bottom: 10px !important;
    }
    
    .analysis-tab {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
    
    .analysis-metrics {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .metric-card {
        padding: 12px !important;
    }
    
    .metric-value {
        font-size: 1.2rem !important;
    }
    
    .metric-label {
        font-size: 0.75rem !important;
    }
}

/* ==================== PLAYER DATA ENHANCED MOBILE ==================== */
@media (max-width: 768px) {
    .data-controls {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 15px !important;
    }
    
    .control-group {
        width: 100% !important;
    }
    
    .data-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 10px !important;
    }
    
    .data-table {
        font-size: 0.8rem !important;
        min-width: 600px !important;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 5px !important;
        font-size: 0.75rem !important;
    }
    
    /* Chart containers */
    .chart-container {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .chart-wrapper {
        height: 250px !important;
    }
    
    /* Filters section */
    .filters-section {
        padding: 15px !important;
    }
    
    .filter-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .filter-item {
        width: 100% !important;
    }
}

/* ==================== TOUCH INTERACTIONS ==================== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .player-card:hover,
    .tool-card:hover,
    button:hover,
    .btn:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    /* Add active states for better feedback */
    .player-card:active,
    .tool-card:active,
    button:active,
    .btn:active {
        transform: scale(0.98) !important;
        opacity: 0.9 !important;
    }
    
    /* Improve scrolling */
    .scrollable {
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }
}

/* ==================== LANDSCAPE MOBILE ==================== */
@media (max-width: 768px) and (orientation: landscape) {
    .predictor-header,
    .simulator-header,
    .premium-hero {
        min-height: auto !important;
        padding: 15px !important;
    }
    
    .chat-panel,
    .team-panel {
        max-height: 400px !important;
    }
    
    .player-results,
    .tools-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==================== SMALL DEVICES (< 380px) ==================== */
@media (max-width: 380px) {
    .container {
        padding: 10px !important;
    }
    
    h1 {
        font-size: 1.3rem !important;
    }
    
    h2 {
        font-size: 1.1rem !important;
    }
    
    .player-card,
    .tool-card {
        padding: 12px !important;
    }
    
    .btn,
    button {
        padding: 10px 15px !important;
        font-size: 0.9rem !important;
    }
    
    .player-slot {
        width: 60px !important;
        height: 70px !important;
    }
    
    .stat-box {
        padding: 5px !important;
    }
    
    .stat-value {
        font-size: 0.85rem !important;
    }
    
    .stat-label {
        font-size: 0.6rem !important;
    }
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Disable complex shadows */
    .player-card,
    .tool-card,
    .container {
        box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
    }
    
    /* Optimize images */
    img {
        image-rendering: auto !important;
    }
    
    /* Hardware acceleration for scrolling */
    .scrollable,
    .player-list,
    .chat-messages {
        transform: translateZ(0);
        will-change: scroll-position;
    }
}

/* ==================== ACCESSIBILITY ==================== */
@media (max-width: 768px) {
    /* Ensure sufficient color contrast */
    .player-card,
    .tool-card {
        border: 2px solid #e9ecef !important;
    }
    
    /* Focus indicators */
    button:focus,
    input:focus,
    select:focus,
    a:focus {
        outline: 3px solid #6f42c1 !important;
        outline-offset: 2px !important;
    }
    
    /* Larger click targets */
    .clickable,
    .interactive {
        position: relative;
        padding: 10px !important;
    }
    
    .clickable::after,
    .interactive::after {
        content: '';
        position: absolute;
        top: -5px;
        right: -5px;
        bottom: -5px;
        left: -5px;
    }
}

/* ==================== LOADING STATES ==================== */
@media (max-width: 768px) {
    .loading-spinner {
        padding: 30px !important;
        font-size: 1rem !important;
    }
    
    .loading-spinner::after {
        width: 25px !important;
        height: 25px !important;
        border-width: 2px !important;
    }
    
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
    }
    
    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
}

/* ==================== FPL PREMIUM HUB SPECIFIC FIXES ==================== */
@media (max-width: 768px) {
    /* Fix overlapping elements */
    .premium-badge {
        position: static !important;
        display: inline-block !important;
        margin-top: 10px !important;
    }
    
    /* Fix text overflow */
    .tool-title,
    .feature-title {
        white-space: normal !important;
        word-wrap: break-word !important;
    }
    
    /* Fix modal/popup positioning */
    .modal,
    .popup {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        margin: 0 !important;
        max-width: none !important;
        max-height: none !important;
        overflow-y: auto !important;
    }
}