/**
 * Live Match Overlay Styles
 * أنماط عرض المباريات المباشرة
 */

/* الحاوي الرئيسي للـ Overlay */
.mms-live-overlay {
    position: fixed;
    z-index: 999999;
    width: 350px;
    max-height: 80vh;
    background: rgba(0, 0, 0, 0.95);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #fff;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* مواضع العرض */
.mms-live-overlay.top-right {
    top: 20px;
    right: 20px;
}

.mms-live-overlay.top-left {
    top: 20px;
    left: 20px;
}

.mms-live-overlay.bottom-right {
    bottom: 20px;
    right: 20px;
}

.mms-live-overlay.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* المظاهر المختلفة */
.mms-live-overlay.light {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border-color: rgba(0, 0, 0, 0.1);
}

.mms-live-overlay.transparent {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
}

/* رأس الـ Overlay */
.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mms-live-overlay.light .overlay-header {
    background: rgba(0, 0, 0, 0.05);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.overlay-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
}

.live-indicator {
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.overlay-controls {
    display: flex;
    gap: 4px;
}

.control-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mms-live-overlay.light .control-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.control-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* محتوى الـ Overlay */
.overlay-content {
    max-height: calc(80vh - 120px);
    overflow-y: auto;
}

.overlay-content::-webkit-scrollbar {
    width: 4px;
}

.overlay-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.overlay-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

/* عنصر المباراة */
.match-item {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s;
}

.mms-live-overlay.light .match-item {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.match-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mms-live-overlay.light .match-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.match-item:last-child {
    border-bottom: none;
}

/* رأس المباراة */
.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.league-info {
    font-size: 12px;
    opacity: 0.8;
}

.match-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
}

.status-live {
    background: #ff4444;
    color: #fff;
}

.status-finished {
    background: #666;
    color: #fff;
}

.status-halftime {
    background: #ff9500;
    color: #fff;
}

.match-time {
    font-weight: 700;
}

/* الفرق والنتيجة */
.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.team-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
}

.team-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-placeholder {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.team-name {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* النتيجة */
.match-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
}

.score-separator {
    font-size: 16px;
    opacity: 0.6;
}

.home-score, .away-score {
    min-width: 24px;
    text-align: center;
}

/* أحداث المباراة */
.match-events {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mms-live-overlay.light .match-events {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.recent-events {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 11px;
}

.event-icon {
    width: 12px;
    height: 12px;
}

.goal-icon {
    color: #4CAF50;
}

.card-icon.yellow {
    color: #FFC107;
}

.card-icon.red {
    color: #F44336;
}

/* ذيل الـ Overlay */
.overlay-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    opacity: 0.8;
}

.mms-live-overlay.light .overlay-footer {
    background: rgba(0, 0, 0, 0.03);
    border-top-color: rgba(0, 0, 0, 0.1);
}

.auto-update-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.update-dot {
    width: 6px;
    height: 6px;
    background: #4CAF50;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* حالة عدم وجود مباريات */
.no-matches {
    padding: 32px 16px;
    text-align: center;
    opacity: 0.7;
}

.no-matches p {
    margin: 0;
    font-size: 14px;
}

/* إشعارات الأحداث */
.mms-match-notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000000;
    pointer-events: none;
}

.notification-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    animation: slideIn 0.5s ease forwards;
    pointer-events: auto;
    cursor: pointer;
    max-width: 300px;
}

.notification-item.goal {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.notification-item.card {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

.notification-item.red-card {
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

.notification-item.fade-out {
    animation: slideOut 0.5s ease forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
}

.notification-icon {
    font-size: 18px;
}

.notification-content {
    font-size: 14px;
    line-height: 1.4;
}

.notification-teams {
    font-weight: 500;
    margin-bottom: 4px;
}

.notification-details {
    font-size: 12px;
    opacity: 0.9;
}

/* حالة مصغرة */
.mms-live-overlay.minimized {
    height: 60px;
    overflow: hidden;
}

.mms-live-overlay.minimized .overlay-content,
.mms-live-overlay.minimized .overlay-footer {
    display: none;
}

.mms-live-overlay.minimized .overlay-header {
    border-bottom: none;
}

/* تأثيرات الحركة */
.mms-live-overlay.slide-in {
    animation: overlaySlideIn 0.3s ease;
}

.mms-live-overlay.slide-out {
    animation: overlaySlideOut 0.3s ease;
}

@keyframes overlaySlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes overlaySlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .mms-live-overlay {
        width: calc(100vw - 40px);
        max-width: 350px;
        left: 20px !important;
        right: 20px !important;
    }
    
    .mms-live-overlay.top-left,
    .mms-live-overlay.top-right {
        top: 10px;
    }
    
    .mms-live-overlay.bottom-left,
    .mms-live-overlay.bottom-right {
        bottom: 10px;
    }
    
    .match-teams {
        gap: 8px;
    }
    
    .team-logo {
        width: 28px;
        height: 28px;
    }
    
    .score-display {
        font-size: 20px;
    }
    
    .mms-match-notifications {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .notification-item {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

/* تحسينات الأداء */
.mms-live-overlay * {
    box-sizing: border-box;
}

.mms-live-overlay img {
    will-change: transform;
}

.overlay-content {
    will-change: scroll-position;
}

/* حالة التحميل */
.overlay-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 8px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* تحسينات إضافية للمظهر الفاتح */
.mms-live-overlay.light .loading-spinner {
    border-color: rgba(0, 0, 0, 0.3);
    border-top-color: #333;
}

.mms-live-overlay.light .live-indicator {
    background: #ff4444;
}

.mms-live-overlay.light .update-dot {
    background: #4CAF50;
}