/* wp-plugin/frontend.css */
:root {
    --ph-bg-card: rgba(255, 255, 255, 0.95);
    --ph-border-card: rgba(0, 0, 0, 0.08);
    --ph-shadow-card: 0 2px 12px 0 rgba(31, 38, 135, 0.08);
    --ph-text-main: #1e293b;
    --ph-text-muted: #64748b;
    --ph-text-light: #94a3b8;

    --ph-color-home: #3b82f6;
    --ph-color-draw: #94a3b8;
    --ph-color-away: #ef4444;
    --ph-color-home-bg: #eff6ff;
    --ph-color-draw-bg: #f8fafc;
    --ph-color-away-bg: #fef2f2;
}

/* =============================================
   Grid Layout
   ============================================= */
.ph-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 28px 0;
}

@media (min-width: 640px) {
    .ph-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .ph-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =============================================
   Card Shell
   ============================================= */
.ph-card,
.ph-single-card {
    background: var(--ph-bg-card);
    border: 1px solid var(--ph-border-card);
    border-radius: 16px;
    box-shadow: var(--ph-shadow-card);
    color: var(--ph-text-main);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ph-card:hover,
.ph-single-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px 0 rgba(31, 38, 135, 0.14);
}

.ph-single-card {
    max-width: 460px;
    margin: 28px auto;
}

/* =============================================
   Banner (date + venue)
   ============================================= */
.ph-card-banner {
    background: #1e3a5f;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 500;
    letter-spacing: 0.03em;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* =============================================
   Card Header (teams)
   ============================================= */
.ph-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 20px 16px;
    gap: 0;
}

.ph-team {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.ph-team.ph-home { text-align: right; padding-right: 8px; }
.ph-team.ph-away { text-align: left; padding-left: 8px; }

.ph-vs {
    margin: 0 10px;
    font-size: 0.72rem;
    color: var(--ph-text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    flex: 0 0 auto;
}

/* =============================================
   Probability Bars
   ============================================= */
.ph-card-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 20px 20px;
}

.ph-bar-container {
    height: 34px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.ph-bar {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: "Courier New", monospace;
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 8px;
    letter-spacing: 0.02em;
    gap: 6px;
    min-width: 40px;
    justify-content: flex-start;
}

.ph-bar-home  { background: linear-gradient(90deg, #1d4ed8, var(--ph-color-home)); }
.ph-bar-draw  { background: linear-gradient(90deg, #64748b, var(--ph-color-draw)); }
.ph-bar-away  { background: linear-gradient(90deg, #b91c1c, var(--ph-color-away)); }

/* =============================================
   Card Footer (xG + Share)
   ============================================= */
.ph-card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--ph-text-muted);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 10px 20px;
    letter-spacing: 0.01em;
}

.ph-xg { font-weight: 600; color: var(--ph-text-main); }

.ph-footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ph-value-badge {
    display: flex;
    align-items: center;
}

.ph-value-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.ph-value-over {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.ph-value-under {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* =============================================
   News Accordion
   ============================================= */
.ph-news-accordion {
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    margin-top: 0;
}

.ph-news-accordion summary {
    list-style: none;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--ph-text-muted);
    outline: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.03em;
    padding: 14px 20px;
    transition: color 0.2s ease;
}

.ph-news-accordion summary:hover { color: var(--ph-text-main); }

.ph-news-accordion summary::after {
    content: '▾';
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 0.85rem;
    color: var(--ph-text-light);
}

.ph-news-accordion[open] summary::after { transform: rotate(-180deg); }

.ph-news-content {
    padding: 0 20px 18px;
    animation: ph-fadeIn 0.25s ease;
}

.ph-news-text {
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--ph-text-main);
    border-left: 3px solid var(--ph-color-home);
    padding-left: 12px;
    margin: 0 0 14px;
}

.ph-news-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ph-source-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    color: #2563eb;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.ph-source-chip::before { content: '🔗'; font-size: 0.68rem; }

.ph-source-chip:hover {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

/* =============================================
   Footer + Utilities
   ============================================= */
.ph-footer-info {
    text-align: center;
    font-size: 0.78rem;
    color: var(--ph-text-light);
    margin-top: 28px;
    letter-spacing: 0.02em;
}

@keyframes ph-fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   Search
   ============================================= */
.ph-search-container {
    margin: 20px 0;
}

.ph-search-form {
    display: flex;
    gap: 8px;
    max-width: 400px;
}

.ph-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--ph-border-card);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--ph-bg-card);
    color: var(--ph-text-main);
    outline: none;
    transition: border-color 0.2s ease;
}

.ph-search-input:focus {
    border-color: var(--ph-color-home);
}

.ph-search-btn {
    padding: 10px 18px;
    background: var(--ph-color-home);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: opacity 0.2s ease;
}

.ph-search-btn:hover {
    opacity: 0.85;
}

/* =============================================
   Pagination
   ============================================= */
.ph-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 28px 0;
}

.ph-page-info {
    font-size: 0.82rem;
    color: var(--ph-text-muted);
}

.ph-page-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.ph-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--ph-border-card);
    border-radius: 8px;
    background: var(--ph-bg-card);
    color: var(--ph-text-main);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ph-page-link:hover {
    border-color: var(--ph-color-home);
    color: var(--ph-color-home);
}

.ph-page-active {
    background: var(--ph-color-home);
    border-color: var(--ph-color-home);
    color: #fff;
}

.ph-page-active:hover {
    color: #fff;
}

/* =============================================
   Share (inside footer)
   ============================================= */
.ph-share {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.ph-share-btn {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ph-text-muted);
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.ph-share-btn:hover {
    border-color: var(--ph-color-home);
    color: var(--ph-color-home);
}

.ph-share-fallback {
    display: none;
    gap: 4px;
}

.ph-share-link {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

.ph-share-wa {
    background: #25d366;
    color: #fff;
}
.ph-share-wa:hover { opacity: 0.85; }

.ph-share-x {
    background: #000;
    color: #fff;
}
.ph-share-x:hover { opacity: 0.8; }

.ph-share-copy {
    background: rgba(0, 0, 0, 0.06);
    color: var(--ph-text-main);
}
.ph-share-copy:hover { background: rgba(0, 0, 0, 0.12); }

/* =============================================
   Historical Accordion
   ============================================= */
.ph-historical-accordion {
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    margin-top: 0;
}

.ph-historical-accordion summary {
    list-style: none;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--ph-text-muted);
    outline: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.03em;
    padding: 14px 20px;
    transition: color 0.2s ease;
}

.ph-historical-accordion summary:hover {
    color: var(--ph-text-main);
}

.ph-historical-accordion summary::after {
    content: '▾';
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 0.85rem;
    color: var(--ph-text-light);
}

.ph-historical-accordion[open] summary::after {
    transform: rotate(-180deg);
}

.ph-historical-content {
    padding: 0 20px 18px;
    animation: ph-fadeIn 0.25s ease;
}

.ph-historical-loading {
    font-size: 0.82rem;
    color: var(--ph-text-muted);
    font-style: italic;
}

.ph-historical-lines {
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--ph-text-main);
    letter-spacing: 0.01em;
}

/* === Post-Match Results === */

.ph-result-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.ph-score-display {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0 12px;
    letter-spacing: 0.05em;
}

.ph-accuracy-bar {
    text-align: center;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: #f0f4ff;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
}

.ph-comparison-accordion {
    border-top: 1px solid #e0e0e0;
}

.ph-comparison-content {
    padding: 12px 16px;
    font-size: 0.85rem;
    line-height: 1.7;
}

.ph-comparison-prediction {
    margin-bottom: 8px;
}

.ph-comparison-prediction strong,
.ph-comparison-result strong {
    display: inline-block;
    margin-right: 6px;
    color: #555;
}

.ph-comp-item {
    padding: 2px 6px;
    border-radius: 3px;
}

.ph-comp-actual {
    background: #fff3e0;
    font-weight: 700;
    border-bottom: 2px solid #ff9800;
}

.ph-comp-sep {
    color: #ccc;
    margin: 0 4px;
}

.ph-comp-correct {
    color: #2e7d32;
    font-weight: 700;
}

.ph-comp-wrong {
    color: #c62828;
    font-weight: 700;
}

.ph-comp-uncertain {
    color: #757575;
    font-style: italic;
}

@media (max-width: 600px) {
    .ph-score-display {
        font-size: 1.1rem;
        margin: 0 8px;
    }
}