/**
 * Pool Tracker Enhanced Features CSS
 * Mobile-first, touch-optimized styles for analytics, social, and betting features
 */

/* ==========================================
   QUICK SCORE MODAL (Mobile-First)
   ========================================== */

.quick-score-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.quick-score-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.quick-score-container {
    background: #fff;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.quick-score-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.quick-score-header h2 {
    margin: 0;
    font-size: 24px;
}

.close-quick-score {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-quick-score:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quick-score-body {
    padding: 30px 20px;
}

.player-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.player-select-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-select-card label {
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.player-dropdown {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s;
}

.player-dropdown:focus {
    outline: none;
    border-color: #667eea;
}

.vs-divider {
    font-weight: 700;
    color: #667eea;
    font-size: 20px;
    margin-top: 25px;
}

.winner-selector {
    display: none;
    margin-bottom: 30px;
}

.winner-selector h3 {
    text-align: center;
    margin: 0 0 20px 0;
    color: #333;
}

.winner-buttons {
    display: flex;
    gap: 15px;
}

.winner-btn {
    flex: 1;
    padding: 20px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 120px;
    justify-content: center;
}

.winner-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.winner-btn.selected {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    transform: scale(1.05);
}

.winner-icon {
    font-size: 36px;
}

.winner-name {
    font-weight: 600;
    font-size: 16px;
}

.btn-submit-score {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-submit-score:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-submit-score:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.success-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4CAF50;
    color: white;
    padding: 30px 50px;
    border-radius: 16px;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 10px 40px rgba(76, 175, 80, 0.4);
    opacity: 0;
    transition: opacity 0.3s;
}

.success-animation.show {
    opacity: 1;
}

/* ==========================================
   ACTIVITY FEED
   ========================================== */

#activity-feed {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.activity-item:hover {
    background: #f9f9f9;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 60px;
}

.activity-badge .badge-tier {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.activity-content {
    flex: 1;
}

.activity-message {
    font-size: 15px;
    color: #333;
    margin-bottom: 5px;
}

.activity-time {
    font-size: 12px;
    color: #999;
}

/* ==========================================
   PLAYER BADGES
   ========================================== */

.player-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 2px solid;
    border-radius: 20px;
    background: white;
}

.badge-icon {
    font-size: 24px;
}

.badge-tier {
    font-weight: 700;
    font-size: 14px;
}

.badge-description {
    font-size: 11px;
    color: #666;
    display: none;
}

@media (min-width: 768px) {
    .badge-description {
        display: inline;
    }
}

/* ==========================================
   ANALYTICS CHARTS
   ========================================== */

.analytics-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

#performance-chart,
#h2h-chart {
    max-width: 100%;
    height: 300px;
}

.probability-meter {
    margin: 20px 0;
}

.probability-bar {
    display: flex;
    height: 60px;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.player1-prob,
.player2-prob {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    transition: width 0.5s ease;
}

.player1-prob {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.player2-prob {
    background: linear-gradient(90deg, #f44336 0%, #e91e63 100%);
}

.probability-details {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
}

.probability-details p {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

/* ==========================================
   BETTING HISTORY & LEADERBOARD
   ========================================== */

.betting-history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.betting-history-modal .modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
}

.roi-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.roi-stat {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.roi-stat .label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.roi-stat .value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.history-list {
    margin: 30px 0;
}

.bet-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.leaderboard-table {
    overflow-x: auto;
    margin: 20px 0;
}

.leaderboard-table table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.leaderboard-table th {
    background: #f9f9f9;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    color: #666;
}

.leaderboard-table tr:hover {
    background: #f9f9f9;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

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

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

/* ==========================================
   MOBILE OPTIMIZATIONS
   ========================================== */

@media (max-width: 768px) {
    .quick-score-container {
        width: 95%;
        max-height: 95vh;
    }

    .player-selector {
        flex-direction: column;
        gap: 10px;
    }

    .vs-divider {
        margin: 10px 0;
    }

    .winner-buttons {
        flex-direction: column;
    }

    .winner-btn {
        min-height: 80px;
    }

    .roi-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .leaderboard-table {
        font-size: 12px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px;
    }
}

/* ==========================================
   TOUCH OPTIMIZATIONS
   ========================================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes on touch devices */
    .winner-btn {
        min-height: 100px;
        padding: 25px;
    }

    button, 
    .player-dropdown,
    select,
    input {
        min-height: 44px; /* iOS minimum touch target */
    }

    /* Remove hover effects on touch devices */
    .winner-btn:hover,
    .activity-item:hover,
    .close-quick-score:hover,
    .btn-submit-score:hover:not(:disabled) {
        transform: none;
    }

    /* Add active states instead */
    .winner-btn:active {
        transform: scale(0.98);
    }

    .btn-submit-score:active:not(:disabled) {
        transform: scale(0.98);
    }
}

/* ==========================================
   DARK MODE SUPPORT
   ========================================== */

@media (prefers-color-scheme: dark) {
    .quick-score-container,
    .analytics-container,
    #activity-feed,
    .betting-history-modal .modal-content {
        background: #1e1e1e;
        color: #e0e0e0;
    }

    .player-dropdown,
    .winner-btn {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }

    .activity-item:hover,
    .probability-details,
    .roi-stat {
        background: #2a2a2a;
    }

    .activity-message,
    .roi-stat .value {
        color: #e0e0e0;
    }

    .player-select-card label,
    .activity-time,
    .roi-stat .label,
    .probability-details p {
        color: #aaa;
    }

    .leaderboard-table th {
        background: #2a2a2a;
        color: #aaa;
    }

    .leaderboard-table tr:hover {
        background: #2a2a2a;
    }
}
