/*
Theme Name: Anglijas Premjerlīga
Theme URI: https://anglijaspremjerliga.lv
Author: anglijaspremjerliga.lv
Author URI: https://anglijaspremjerliga.lv
Description: Anglijas Premjerlīgas turnīra tabula, spēles, likmju koeficienti un statistika latviešu valodā. Gaišs/tumšs režīms, pielāgots planšetēm un mobilajām ierīcēm. Nav saistīts ar oficiālo Premier League organizāciju.
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: anglijaspremjerliga
*/

:root {
  --bg: #0b0d12;
  --card: #12141b;
  --card2: #0e1017;
  --hover: #181b24;
  --border: #232734;
  --border2: #1a1d27;
  --text: #e8eaf0;
  --text2: #c6cad6;
  --muted: #8b91a3;
  --faint: #4b5163;
  --navbg: rgba(11, 13, 18, 0.82);
  --accent: #4ade80;
}

html[data-theme="light"] {
  --bg: #eef0f4;
  --card: #ffffff;
  --card2: #f5f6f9;
  --hover: #e9ebf0;
  --border: #e2e5ec;
  --border2: #edeff3;
  --text: #14161d;
  --text2: #41475a;
  --muted: #6b7183;
  --faint: #aeb4c0;
  --navbg: rgba(248, 249, 251, 0.86);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.apl-wrap { min-height: 100vh; background: var(--bg); padding: 0 16px 60px 16px; }
.apl-inner { max-width: 1060px; margin: 0 auto; }
.apl-inner--narrow { max-width: 900px; }

@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Nav */
.apl-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; margin-bottom: 8px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  background: var(--navbg);
}
.apl-brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.apl-brand img { height: 40px; width: auto; display: block; }
.apl-navlinks { display: flex; align-items: center; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.apl-navlinks::-webkit-scrollbar { display: none; }
.apl-navlinks a {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 700;
  color: var(--text2); white-space: nowrap;
}
.apl-navlinks a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.apl-themebtn {
  display: flex; align-items: center; justify-content: center;
  margin-left: 6px; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text2);
  cursor: pointer; font-size: 16px; flex-shrink: 0;
}
.apl-themebtn:hover { background: var(--hover); color: var(--text); }
.apl-backbtn {
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700;
  color: var(--text2); border: 1px solid var(--border); white-space: nowrap;
}
.apl-backbtn:hover { background: var(--hover); color: var(--text); text-decoration: none; }

/* Header */
.apl-header { padding: 22px 0 18px 0; }
.apl-header h1 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.apl-sub { margin: 4px 0 0 0; font-size: 13px; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.apl-tag { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--hover); border-radius: 6px; padding: 3px 8px; }

.apl-sec-title { margin: 0 0 12px 0; font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; scroll-margin-top: 70px; }
.apl-sec { margin-top: 34px; scroll-margin-top: 70px; }
.apl-sec p.apl-lead { margin: 0 0 14px 0; font-size: 14px; color: var(--muted); max-width: 640px; }

/* Table */
.apl-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px 14px 14px 14px; scroll-margin-top: 70px; }
.apl-scope { display: flex; gap: 8px; padding: 0 6px 14px 6px; }
.apl-scope button {
  border: none; cursor: pointer; border-radius: 999px; padding: 8px 18px; font-size: 13px; font-weight: 700;
  background: var(--hover); color: var(--muted);
}
.apl-scope button.is-active { background: var(--accent); color: #05130a; }

.apl-tbl-head, .apl-tbl-row {
  display: grid;
  grid-template-columns: 30px 40px minmax(140px, 1fr) 44px 36px 36px 36px 56px 64px 144px 48px;
  align-items: center; gap: 0 6px;
}
.apl-tbl-head {
  padding: 6px 6px 10px 6px; font-size: 12px; font-weight: 700; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.apl-tbl-head span { text-align: center; }
.apl-tbl-head .col-team { text-align: left; }
.apl-tbl-head .col-pk { text-align: right; }

.apl-row {
  padding: 9px 6px; border-bottom: 1px solid var(--border2); border-radius: 8px;
  cursor: pointer;
}
.apl-row:hover { background: var(--hover); }
.apl-row-detail { display: none; background: var(--card2); border: 1px solid var(--border); border-radius: 12px; margin: 6px 2px 10px 2px; padding: 16px; }
.apl-row-wrap.is-open .apl-row-detail { display: block; }
.apl-row-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.apl-rd-label { margin: 0 0 8px 0; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.apl-rd-line { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.apl-rd-line .k { color: var(--muted); }
.apl-rd-line .v { font-weight: 700; }
.apl-rd-player { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.apl-rd-player .pn { flex: 1; font-weight: 600; }
.apl-rd-player .pp { color: var(--muted); font-size: 12px; }
@media (max-width: 780px) { .apl-row-detail-grid { grid-template-columns: 1fr; } }
.apl-tbl-row .col-team { text-align: left; }
.apl-pos {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.apl-chip {
  position: relative; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; overflow: visible;
}
.apl-chip img { position: absolute; inset: -22%; width: 144%; height: 144%; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45)); z-index: 1; }
.apl-team-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apl-cell { text-align: center; font-size: 13px; color: var(--text2); }
.apl-cell-pts { text-align: right; font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 700; }
.apl-form { display: flex; gap: 3px; justify-content: center; align-items: center; }
.apl-form .apl-fc { width: 22px; height: 22px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }

.apl-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 6px 4px 6px; font-size: 12px; color: var(--muted); }
.apl-legend span { display: flex; align-items: center; gap: 6px; }
.apl-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.apl-hint { margin: 8px 6px 0 6px; font-size: 12px; color: var(--muted); }

/* Fixtures */
.apl-fx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.apl-fx {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: pointer;
}
.apl-fx:hover { border-color: #3a4054; }
.apl-fx-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.apl-fx-teams { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.apl-fx-team { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.apl-fx-chip { position: relative; width: 21px; height: 21px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; }
.apl-fx-chip img { position: absolute; inset: -22%; width: 144%; height: 144%; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45)); z-index: 1; }
.apl-fx-time { min-width: 84px; text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); }
.apl-fx-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; display: none; }
.apl-fx.is-open .apl-fx-detail { display: block; }

/* Odds */
.apl-odds-label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; display: block; }
.apl-odds-grid { display: grid; grid-template-columns: 1fr 52px 52px 52px; gap: 5px; align-items: center; }
.apl-odds-head { margin-bottom: 5px; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.apl-odds-head span:not(:first-child) { text-align: center; }
.apl-odds-rows { display: flex; flex-direction: column; gap: 5px; }
.apl-bk { font-size: 13px; font-weight: 700; color: var(--text); }
.apl-o { text-align: center; font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 700; padding: 5px 0; border-radius: 7px; background: var(--card2); color: var(--text2); border: 1px solid var(--border); }
.apl-o.is-best { background: #12301f; color: #4ade80; border: 1px solid #1c5136; }
html[data-theme="light"] .apl-o.is-best { background: #e4f7ec; color: #16794a; border: 1px solid #b7e5c8; }
.apl-odds-note { margin: 8px 0 0 0; font-size: 11px; color: var(--muted); }

/* SEO / article */
.apl-article { margin-top: 48px; scroll-margin-top: 70px; max-width: 820px; font-size: 15px; line-height: 1.75; color: var(--text2); }
.apl-article h2 { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; color: var(--text); margin: 28px 0 14px 0; }
.apl-article h3 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; color: var(--text); margin: 22px 0 10px 0; }
.apl-article p { margin: 0 0 14px 0; }
.apl-article ul { margin: 0 0 14px 0; padding-left: 22px; }
.apl-article li { margin-bottom: 8px; }
.apl-article ol { margin: 0 0 14px 0; padding-left: 22px; }
.apl-article strong { color: var(--text); }

/* SEO tables */
.apl-seo-tablewrap { overflow-x: auto; margin: 0 0 28px 0; border: 1px solid var(--border); border-radius: 12px; }
.apl-seo-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
.apl-seo-table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); background: var(--hover); white-space: nowrap; }
.apl-seo-table th.r, .apl-seo-table td.r { text-align: right; white-space: nowrap; }
.apl-seo-table td { padding: 10px 12px; border-bottom: 1px solid var(--border2); color: var(--text2); }
.apl-seo-table tbody tr:nth-child(odd) { background: var(--card); }
.apl-seo-table tbody tr:nth-child(even) { background: var(--card2); }
.apl-seo-table td.team { font-weight: 700; color: var(--text); }
.apl-new { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 800; color: #16794a; background: #d9f2e3; border-radius: 5px; padding: 1px 6px; vertical-align: middle; }
html[data-theme="dark"] .apl-new { color: #4ade80; background: #10261a; }
.apl-note { margin: 0 0 28px 0; font-size: 13px; color: var(--muted); }

/* FAQ */
.apl-faq { display: flex; flex-direction: column; gap: 18px; margin-bottom: 28px; }
.apl-faq h3 { margin: 0 0 6px 0; font-size: 16px; font-weight: 700; color: var(--text); font-family: 'Space Grotesk', sans-serif; }
.apl-faq p { margin: 0; }

/* Page (privacy etc.) */
.apl-page-head { padding: 28px 0 22px 0; }
.apl-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.apl-page-head h1 { margin: 8px 0 6px 0; font-family: 'Space Grotesk', sans-serif; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.apl-page-meta { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.apl-callout { margin: 0 0 14px 0; padding: 14px 18px; border-radius: 12px; background: var(--card2); border: 1px solid var(--border); }
.apl-callout p { margin: 0; color: var(--text); font-weight: 600; }

/* Footer */
.apl-footer { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.apl-footer p { margin: 0 0 6px 0; }
.apl-footer .apl-foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.apl-footer a { color: var(--text2); font-weight: 700; }
.apl-footer a:hover { color: var(--text); }

/* Squad browser (players by team) */
.apl-team-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.apl-team-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  cursor: pointer; font-size: 13px; font-weight: 700; white-space: nowrap; font-family: inherit;
  border: 1px solid var(--border); background: transparent; color: var(--text2);
}
.apl-team-btn:hover { background: var(--hover); color: var(--text); }
.apl-team-btn.is-active { border-color: var(--accent); background: var(--hover); color: var(--text); }
.apl-team-btn .apl-chip { width: 22px; height: 22px; font-size: 9px; }
.apl-squad-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.apl-squad-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.apl-squad-head .apl-chip { width: 34px; height: 34px; font-size: 12px; }
.apl-squad-name { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; color: var(--text); }
.apl-squad-panel { display: none; }
.apl-squad-panel.is-active { display: block; }
.apl-player-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--border2); font-size: 14px; }
.apl-player-row .n { font-weight: 700; color: var(--text); }
.apl-player-row .p { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--hover); border-radius: 6px; padding: 4px 10px; }

/* Responsive: tablet + mobile */
@media (max-width: 780px) {
  .apl-wrap { padding-left: 12px; padding-right: 12px; }
  .apl-card { padding-left: 8px; padding-right: 8px; }
  .apl-header h1 { font-size: 22px; }
  .apl-tbl-head, .apl-tbl-row { grid-template-columns: 26px 30px minmax(70px, 1fr) 34px 44px 100px 40px; gap: 0 6px; }
  .apl-hm { display: none !important; }
  .apl-chip { width: 19px; height: 19px; font-size: 10px; }
  .apl-chip img { inset: 0; width: 100%; height: 100%; }
  .apl-fx-grid { grid-template-columns: 1fr; }
  .apl-odds-grid { grid-template-columns: 1fr 46px 46px 46px; }
  .apl-page-head h1 { font-size: 27px; }
  .apl-article h2 { font-size: 21px; }
}
@media (max-width: 440px) {
  .apl-tbl-head, .apl-tbl-row { grid-template-columns: 26px 26px minmax(52px, 1fr) 30px 40px 88px 34px; gap: 0 5px; font-size: 12px; }
  .apl-pos { width: 22px; height: 22px; font-size: 11px; }
  .apl-chip { width: 18px; height: 18px; }
  .apl-header h1 { font-size: 20px; }
  .apl-sec-title, .apl-sec .apl-sec-title { font-size: 18px; }
  .apl-odds-grid { grid-template-columns: 1fr 42px 42px 42px; }
  .apl-page-head h1 { font-size: 24px; }
}
