/* 
 * AI Studio — 365Scores Widget Styles
 * Mimics the modern aesthetic of 365Scores.
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');

:root {
    --ais-365-bg: #151e22;
    --ais-365-surface: #1e262a;
    --ais-365-text: #ffffff;
    --ais-365-text-muted: #9da0a2;
    --ais-365-divider: rgba(255, 255, 255, 0.05);
    --ais-365-accent: #ff495c; /* Used for live games */
    --ais-365-radius: 12px;
    --ais-365-font: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
}

/* Light Mode Fallback or toggle */
.ais-365-light-theme {
    --ais-365-bg: #f3f3f3;
    --ais-365-surface: #ffffff;
    --ais-365-text: #151e22;
    --ais-365-text-muted: #6b7173;
    --ais-365-divider: rgba(0, 0, 0, 0.05);
}

.ais-365-widget {
    font-family: var(--ais-365-font);
    background: var(--ais-365-bg);
    color: var(--ais-365-text);
    border-radius: var(--ais-365-radius);
    padding: 16px;
    max-width: 800px;
    margin: 20px auto;
    direction: rtl; /* Usually Arabic by default based on langId=27 */
    box-sizing: border-box;
}

.ais-365-widget * {
    box-sizing: border-box;
    font-family: inherit;
}

/* Competition Header / Cards Grid */
.ais-365-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.ais-365-card-btn {
    background: var(--ais-365-surface);
    color: var(--ais-365-text-muted);
    border: 1px solid var(--ais-365-divider);
    border-radius: 8px; /* Card look instead of pill */
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--ais-365-font);
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1 1 calc(33.333% - 10px); /* 3 cards per row */
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ais-365-card-btn:hover {
    color: var(--ais-365-text);
    background: rgba(255,255,255,0.05);
    border-color: var(--ais-365-text-muted);
}

.ais-365-card-btn.active {
    background: var(--ais-365-accent); /* Make active pop more */
    color: #fff;
    border-color: var(--ais-365-accent);
}

.ais-365-competition {
    margin-bottom: 24px;
    background: var(--ais-365-surface);
    border-radius: var(--ais-365-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none; /* Hide inactive competitions */
}

.ais-365-competition.active {
    display: block;
}

.ais-365-competition {
    margin-bottom: 24px;
    background: var(--ais-365-surface);
    border-radius: var(--ais-365-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.ais-365-competition.active {
    display: block;
}

.ais-365-comp-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 16px;
    border-bottom: 1px solid var(--ais-365-divider);
    display: flex;
    align-items: center;
}

.ais-365-comp-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--ais-365-text);
}

/* Games List */
.ais-365-games-list {
    display: flex;
    flex-direction: column;
}

.ais-365-game-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ais-365-divider);
    transition: background 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}

.ais-365-game-row:last-child {
    border-bottom: none;
}

.ais-365-game-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Teams */
.ais-365-team {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ais-365-team-home {
    justify-content: flex-end;
    text-align: left;
}

.ais-365-team-away {
    justify-content: flex-start;
    text-align: right;
}

.ais-365-team-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    color: var(--ais-365-text) !important;
}

.ais-365-team-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Custom Scrollbar */
.ais-365-widget {
    scrollbar-width: thin;
    scrollbar-color: #4a555a rgba(0, 0, 0, 0.1);
}
.ais-365-widget ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.ais-365-widget ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.ais-365-widget ::-webkit-scrollbar-thumb {
    background: #4a555a;
    border-radius: 4px;
}
.ais-365-widget ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Scores */
.ais-365-score-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 80px;
    font-size: 18px;
    font-weight: 700;
    margin: 0 16px;
    color: var(--ais-365-text) !important;
}

.ais-365-score {
    color: var(--ais-365-text) !important;
}

.ais-365-score-divider {
    color: var(--ais-365-text-muted) !important;
}

.ais-365-time {
    font-size: 13px;
    font-weight: 500;
    color: var(--ais-365-text-muted);
}

/* Status (e.g. 90', FT) */
.ais-365-status {
    font-size: 12px;
    color: var(--ais-365-text-muted);
    min-width: 40px;
    text-align: left;
    margin-right: 16px;
}

.ais-365-status-live {
    color: var(--ais-365-accent);
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Error/Empty */
.ais-365-error, .ais-365-empty {
    padding: 20px;
    text-align: center;
    background: var(--ais-365-surface);
    color: var(--ais-365-text);
    border-radius: var(--ais-365-radius);
    margin: 20px 0;
}

/* Responsive */
@media (max-width: 600px) {
    .ais-365-team-name {
        max-width: 80px;
        font-size: 12px;
    }
    .ais-365-score-box {
        font-size: 16px;
        margin: 0 8px;
        min-width: 60px;
    }
    .ais-365-game-row {
        padding: 12px 8px;
        grid-template-columns: 1fr auto 1fr; /* Hide status text on small screens, show underneath if needed */
    }
    .ais-365-status {
        display: none;
    }
}

/* Standings Table */
.ais-365-standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: center;
}

.ais-365-standings-table th {
    padding: 12px 8px;
    color: var(--ais-365-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--ais-365-divider);
    background: rgba(0,0,0,0.2);
}

.ais-365-standings-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--ais-365-divider);
}

.ais-365-standings-table tr:last-child td {
    border-bottom: none;
}

.ais-365-standings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ais-365-team-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: right;
    justify-content: flex-start;
}

.ais-365-rank {
    width: 20px;
    font-weight: 700;
    color: var(--ais-365-text-muted);
}

.ais-365-pts {
    font-weight: 700;
    color: var(--ais-365-text);
}
