/**
 * SportPro Extra CSS
 * RTL, Accessibility, Ads, Components, Web Vitals
 */

/* ─── RTL Base ────────────────────────────────────────── */
[dir="rtl"] *, body { direction: rtl; unicode-bidi: embed; }
[dir="rtl"] .sp-section-header { flex-direction: row; }

/* ─── Skip Link (Accessibility) ──────────────────────── */
.sp-skip-link {
    position: absolute;
    top: -9999px;
    left: -9999px;
    z-index: 9999;
    padding: 8px 16px;
    background: #e63946;
    color: #fff;
    font-weight: 700;
    border-radius: 4px;
}
.sp-skip-link:focus {
    top: 8px;
    left: 8px;
}

/* ─── Focus Styles (Accessibility) ───────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #e63946;
    outline-offset: 2px;
}

/* ─── Screen Reader Only ─────────────────────────────── */
.sp-screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal;
}

/* ─── Grid System ─────────────────────────────────────── */
.sp-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.sp-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (max-width: 900px) {
    .sp-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .sp-grid-3, .sp-grid-2 { grid-template-columns: 1fr; }
}

/* ─── Sections ────────────────────────────────────────── */
.sp-section { padding: 32px 0; }
.sp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.sp-see-all {
    font-size: 13px;
    color: #e63946;
    font-weight: 700;
}
.sp-see-all:hover { text-decoration: underline; }

/* ─── News Card ───────────────────────────────────────── */
.sp-news-card { transition: transform .2s, box-shadow .2s; }
.sp-news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.sp-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}
.sp-card-thumb { position: relative; overflow: hidden; display: block; }
.sp-card-thumb img { transition: transform .3s; }
.sp-card-thumb:hover img { transform: scale(1.03); }
.sp-card-body { padding: 14px; }
.sp-card-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; line-height: 1.5; }
.sp-card-title a { color: #e0e6f0; }
.sp-card-title a:hover { color: #e63946; }
.sp-card-excerpt { font-size: 12px; color: #aaaaaa; line-height: 1.6; margin-bottom: 10px; }
.sp-card-meta { font-size: 11px; color: #6b7fa3; display: flex; align-items: center; gap: 12px; }
.sp-card-meta time::before { content: "🕒 "; }
.sp-card-author::before { content: "✍️ "; }

/* ─── Matches ─────────────────────────────────────────── */
.sp-matches-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
@media (max-width: 1024px) { .sp-matches-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .sp-matches-grid { grid-template-columns: 1fr; } }

.sp-match-card { padding: 14px; text-align: center; }
.sp-match-status {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.sp-match-status.live { background: #e63946; color: #fff; animation: sp-pulse 1.5s infinite; }
.sp-match-status.upcoming { background: #1e3a5f; color: #7eb3f5; }
.sp-match-status.finished { background: #1e2a42; color: #6b7fa3; }
.sp-match-status.postponed { background: #2a2010; color: #f59e0b; }

@keyframes sp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

.sp-match-teams { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.sp-team-name { font-size: 13px; font-weight: 700; flex: 1; }
.sp-team-name:first-child { text-align: right; }
.sp-team-name:last-child  { text-align: left; }
.sp-score {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 22px;
    font-weight: 900;
    color: #e63946;
    min-width: 60px;
    justify-content: center;
}
.sp-vs { font-size: 13px; color: #6b7fa3; }
.sp-match-info { font-size: 11px; color: #6b7fa3; }
.sp-match-league { display: block; margin-top: 4px; }

/* ─── Standings Table ─────────────────────────────────── */
.sp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sp-standings-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sp-standings-table th {
    background: #0d1120;
    color: #aaaaaa;
    font-size: 11px;
    font-weight: 700;
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #1e2a42;
    white-space: nowrap;
}
.sp-standings-table th:nth-child(2) { text-align: right; }
.sp-standings-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #0f1724;
    color: #c0cce0;
}
.sp-standings-table td:nth-child(2) { text-align: right; font-weight: 700; color: #e0e6f0; }
.sp-standings-table tr:hover td { background: #0f1724; }
.sp-pts { color: #e63946 !important; font-size: 15px !important; }
.sp-team-cell { display: flex; align-items: center; gap: 8px; }

/* ─── Trending ────────────────────────────────────────── */
.sp-trending-list { display: flex; flex-direction: column; gap: 12px; }
.sp-trending-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #111111;
    border-radius: 8px;
    border: 1px solid #1e2a42;
}
.sp-trending-rank {
    font-size: 20px;
    font-weight: 900;
    color: #1e2a42;
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
}
.sp-trending-item:nth-child(1) .sp-trending-rank { color: #fbbf24; }
.sp-trending-item:nth-child(2) .sp-trending-rank { color: #9ca3af; }
.sp-trending-item:nth-child(3) .sp-trending-rank { color: #cd7c2f; }
.sp-trending-thumb { flex-shrink: 0; }
.sp-trending-thumb img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; }
.sp-trending-content h3 { font-size: 13px; font-weight: 700; line-height: 1.4; margin-bottom: 4px; }
.sp-trending-content h3 a { color: #e0e6f0; }
.sp-trending-content h3 a:hover { color: #e63946; }
.sp-trending-content time { font-size: 11px; color: #6b7fa3; }

/* ─── Ticker ──────────────────────────────────────────── */
.sp-ticker-wrap { overflow: hidden; flex: 1; }
.sp-ticker-content {
    display: inline-block;
    white-space: nowrap;
    animation: sp-ticker 30s linear infinite;
    font-size: 13px;
    color: #b0bcd4;
    padding: 0 16px;
}
@keyframes sp-ticker {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.sp-ticker:hover .sp-ticker-content { animation-play-state: paused; }

/* ─── Sidebar ─────────────────────────────────────────── */
.sp-sidebar { position: sticky; top: 80px; align-self: start; }
.sp-widget { margin-bottom: 24px; }
.sp-widget-title {
    font-size: 14px;
    font-weight: 800;
    color: #e0e6f0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Pagination ─────────────────────────────────────────*/
.sp-pagination { display: flex; justify-content: center; margin: 32px 0; }
.sp-pagination ul { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sp-pagination li a,
.sp-pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    background: #111111;
    border: 1px solid #1e2a42;
    color: #b0bcd4;
    transition: background .2s, color .2s;
}
.sp-pagination li a:hover { background: #e63946; color: #fff; border-color: #e63946; }
.sp-pagination .current { background: #e63946; color: #fff; border-color: #e63946; }

/* ─── Ads ─────────────────────────────────────────────── */
.sp-ad { text-align: center; margin: 16px 0; }
.sp-ad--lazy { opacity: 0; transition: opacity .3s; }
.sp-ad--visible { opacity: 1; }
.sp-ad-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: #0d1120;
    border-top: 1px solid #1e2a42;
    text-align: center;
    padding: 8px;
}
.sp-ad-sticky-close {
    position: absolute;
    top: 4px;
    left: 8px;
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

/* ─── Buttons ─────────────────────────────────────────── */
.sp-btn-outline {
    background: transparent;
    border: 2px solid #e63946;
    color: #e63946;
}
.sp-btn-outline:hover { background: #e63946; color: #fff; }
.sp-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ─── Author / Category Headers ──────────────────────── */
.sp-cat-header, .sp-author-header {
    padding: 20px;
    background: #111111;
    border-radius: 10px;
    border: 1px solid #1e2a42;
}
.sp-cat-header h1 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.sp-cat-desc { font-size: 13px; color: #aaaaaa; margin-top: 8px; }
.sp-author-header { display: flex; gap: 20px; align-items: flex-start; }
.sp-author-avatar img { border-radius: 50%; }
.sp-author-name { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.sp-author-bio { font-size: 13px; color: #aaaaaa; line-height: 1.6; }
.sp-author-meta { font-size: 12px; color: #6b7fa3; margin-top: 8px; }

/* ─── Player & Team Cards ─────────────────────────────── */
.sp-player-card { display: flex; gap: 16px; padding: 16px; }
.sp-player-photo img { width: 80px; height: 100px; object-fit: cover; border-radius: 8px; }
.sp-player-name { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.sp-player-position { font-size: 12px; color: #e63946; font-weight: 700; margin-bottom: 10px; }
.sp-player-stats, .sp-team-details { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sp-player-stats dt, .sp-team-details dt { font-size: 11px; color: #6b7fa3; }
.sp-player-stats dd, .sp-team-details dd { font-size: 12px; font-weight: 700; }
.sp-team-card { display: flex; gap: 16px; padding: 16px; align-items: flex-start; }
.sp-team-logo img { width: 64px; height: 64px; object-fit: contain; }
.sp-team-name { font-size: 16px; font-weight: 800; margin-bottom: 8px; }

/* ─── 404 ─────────────────────────────────────────────── */
.sp-404 { text-align: center; padding: 80px 20px; }
.sp-404 h1 { font-size: 80px; font-weight: 900; color: #e63946; line-height: 1; }
.sp-404 h2 { font-size: 24px; margin: 12px 0; }
.sp-404 p { color: #aaaaaa; margin-bottom: 24px; }

/* ─── Breadcrumb ─────────────────────────────────────── */
.sp-breadcrumb { margin-bottom: 16px; }
.sp-breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sp-breadcrumb li { font-size: 13px; color: #6b7fa3; }
.sp-breadcrumb li a { color: #aaaaaa; }
.sp-breadcrumb li a:hover { color: #e63946; }
.sp-breadcrumb li + li::before { content: "/"; margin-left: 4px; color: #1e2a42; }

/* ─── Spinner ─────────────────────────────────────────── */
.sp-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #1e2a42;
    border-top-color: #e63946;
    border-radius: 50%;
    animation: sp-spin .7s linear infinite;
    margin: 0 auto;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ─── Search Form ─────────────────────────────────────── */
.sp-search-form { position: relative; }
.sp-search-wrap { display: flex; gap: 8px; }
.sp-search-field {
    flex: 1;
    background: #0b0e1a;
    border: 1px solid #1e2a42;
    color: #e0e6f0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
}
.sp-search-field:focus { border-color: #e63946; outline: none; }
.sp-search-btn {
    background: #e63946;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.sp-search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

/* ─── Single Post ─────────────────────────────────────── */
.sp-entry-content {
    font-size: 16px;
    line-height: 1.8;
    color: #c0cce0;
    padding: 24px;
}
.sp-entry-content p { margin-bottom: 1.2em; }
.sp-entry-content h2, .sp-entry-content h3 { color: #e0e6f0; margin: 1.5em 0 .8em; }
.sp-entry-content a { color: #e63946; }
.sp-entry-content img { border-radius: 8px; margin: 1em 0; }
.sp-entry-content blockquote {
    border-right: 4px solid #e63946;
    padding: 12px 20px;
    background: #0d1120;
    border-radius: 0 8px 8px 0;
    margin: 1.5em 0;
    color: #b0bcd4;
}

/* ─── Share Buttons ───────────────────────────────────── */
.sp-share { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.sp-share a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}
.sp-share-facebook { background: #1877f2; }
.sp-share-twitter  { background: #000; }
.sp-share-whatsapp { background: #25d366; }
.sp-share-telegram { background: #0088cc; }

/* ─── CLS Prevention ─────────────────────────────────── */
.sp-hero-img,
.sp-card-thumb img,
.sp-trending-thumb img {
    aspect-ratio: attr(width) / attr(height);
}
img { display: block; }

/* ─── Print ───────────────────────────────────────────── */
@media print {
    #sp-header, .sp-sidebar, .sp-ad, .sp-ticker, .sp-share { display: none !important; }
    .sp-grid-main { display: block; }
    .sp-entry-content { color: #000; }
}

/* ─── Reduced Motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ─── High Contrast ──────────────────────────────────── */
@media (forced-colors: active) {
    .sp-badge, .sp-btn-primary, .sp-match-status.live {
        forced-color-adjust: none;
    }
}
