/**
 * API Football Frontend Styles
 */

/* Base styles for all widgets */
.api-football-widget {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.api-football-table {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.api-football-table thead {
    background: #4A90E2;
    color: white;
    font-weight: 600;
}

.api-football-table th,
.api-football-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.api-football-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-football-table td {
    vertical-align: middle;
}

/* Team logos */
.team-logo {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 2px;
}

.team-name {
    vertical-align: middle;
    font-weight: 500;
}

/* Standings table specific styles */
.standings-table .rank {
    width: 40px;
    text-align: center;
    font-weight: 600;
}

.standings-table .team {
    min-width: 200px;
}

.standings-table .played,
.standings-table .wins,
.standings-table .draws,
.standings-table .losses {
    width: 40px;
    text-align: center;
}

.standings-table .goal-diff {
    width: 50px;
    text-align: center;
}

.standings-table .points {
    width: 50px;
    text-align: center;
    font-weight: 600;
}

.standings-table .form {
    width: 80px;
    text-align: center;
}

/* Position-based row colors */
.position-top {
    background-color: #e8f5e8;
    border-left: 4px solid #4caf50;
}

.position-europe {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.position-relegation {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
}

.position-mid {
    background-color: #fff;
}

/* Form string styling */
.form-string {
    font-family: monospace;
    font-size: 12px;
    letter-spacing: 1px;
}

/* Fixtures list styles */
.fixtures-list {
    padding: 0;
}

.fixture-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
    min-height: 50px;
}

.fixture-item:hover {
    background-color: #f8f9fa;
}

.fixture-item:last-child {
    border-bottom: none;
}

.fixture-date {
    flex: 0 0 80px;
    text-align: left;
    margin-right: 15px;
    min-width: 80px;
}

.fixture-date .date {
    display: block;
    font-weight: 600;
    font-size: 11px;
    color: #333;
    line-height: 1.1;
    margin-bottom: 1px;
}

.fixture-date .time {
    display: block;
    font-size: 10px;
    color: #666;
    line-height: 1.1;
}

.fixture-teams {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
}

.home-team,
.away-team {
    flex: 1;
    display: flex;
    align-items: center;
    max-width: 42%;
    min-width: 0;
}

.away-team {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.away-team .team-logo {
    margin-right: 0;
    margin-left: 5px;
}

.home-team .team-name,
.away-team .team-name {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.match-info {
    flex: 0 0 50px;
    text-align: center;
    margin: 0 10px;
}

.match-info .score {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    line-height: 1.2;
}

.match-info .vs {
    color: #666;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
}

/* Schedule and results table styles */
.schedule-table .date,
.results-table .date {
    width: 100px;
}

.schedule-table .time {
    width: 60px;
    text-align: center;
}

.schedule-table .home-team,
.schedule-table .away-team,
.results-table .home-team,
.results-table .away-team {
    width: 200px;
}

.schedule-table .score,
.results-table .score {
    width: 80px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}

.schedule-table .venue,
.results-table .venue {
    min-width: 150px;
    color: #666;
    font-size: 13px;
}

/* Error messages */
.api-football-error {
    padding: 20px;
    text-align: center;
    color: #d32f2f;
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Color schemes */

/* Blue theme (default) */
.api-football-widget {
    --primary-color: #4A90E2;
    --primary-light: #e3f2fd;
    --primary-dark: #1976d2;
}

/* Green theme */
body.api-football-green .api-football-table thead,
.api-football-widget.color-green .api-football-table thead {
    background: #4caf50;
}

.api-football-widget.color-green {
    --primary-color: #4caf50;
    --primary-light: #e8f5e8;
    --primary-dark: #388e3c;
}

/* Red theme */
body.api-football-red .api-football-table thead,
.api-football-widget.color-red .api-football-table thead {
    background: #f44336;
}

.api-football-widget.color-red {
    --primary-color: #f44336;
    --primary-light: #ffebee;
    --primary-dark: #d32f2f;
}

/* Responsive design */
@media (max-width: 768px) {
    .api-football-table {
        font-size: 13px;
    }
    
    .api-football-table th,
    .api-football-table td {
        padding: 10px 6px;
    }
    
    .team-logo {
        width: 22px;
        height: 22px;
        margin-right: 6px;
    }
    
    .team-name {
        font-size: 13px;
        font-weight: 500;
    }
    
    /* Optimize standings table for tablet */
    .standings-table .team {
        min-width: 140px;
    }
    
    /* Keep essential columns, hide some for compact view */
    .api-football-standings .standings-table .draws,
    .api-football-standings .standings-table .losses {
        display: none;
    }
    
    .fixture-item {
        padding: 12px 15px;
        min-height: 45px;
    }
    
    .fixture-date {
        flex: 0 0 70px;
        margin-right: 12px;
        min-width: 70px;
        text-align: left;
    }
    
    .fixture-date .date {
        font-size: 10px;
    }
    
    .fixture-date .time {
        font-size: 9px;
    }
    
    .fixture-teams {
        min-height: 28px;
    }
    
    .home-team,
    .away-team {
        max-width: 40%;
    }
    
    .away-team .team-logo {
        margin-left: 4px;
    }
    
    .home-team .team-name,
    .away-team .team-name {
        font-size: 11px;
    }
    
    .match-info {
        flex: 0 0 40px;
        margin: 0 8px;
    }
}

@media (max-width: 640px) {
    /* Mobile error messages */
    .api-football-error {
        padding: 16px;
        margin: 15px 0;
        font-size: 13px;
        border-radius: 6px;
    }
    
    /* Better mobile layout for compact standings */
    .api-football-standings .standings-table {
        font-size: 14px;
    }
    
    .api-football-standings .standings-table th,
    .api-football-standings .standings-table td {
        padding: 12px 8px;
    }
    
    .api-football-standings .team-logo {
        width: 24px;
        height: 24px;
        margin-right: 8px;
    }
    
    .api-football-standings .team-name {
        font-size: 14px;
        font-weight: 600;
    }
    
    /* Hide goal difference on smaller screens */
    .api-football-standings .standings-table .goal-diff {
        display: none;
    }
    
    /* Make rank and points more prominent */
    .api-football-standings .standings-table .rank {
        font-size: 16px;
        font-weight: 700;
        color: #333;
    }
    
    .api-football-standings .standings-table .points {
        font-size: 16px;
        font-weight: 700;
        color: #333;
    }
    
    /* Improve fixtures on mobile */
    .api-football-fixtures .fixture-item {
        padding: 10px 12px;
        min-height: 40px;
    }
    
    .api-football-fixtures .fixture-date {
        flex: 0 0 65px;
        margin-right: 10px;
        min-width: 65px;
    }
    
    .api-football-fixtures .fixture-date .date {
        font-size: 10px;
    }
    
    .api-football-fixtures .fixture-date .time {
        font-size: 9px;
    }
    
    .api-football-fixtures .team-logo {
        width: 20px;
        height: 20px;
        margin-right: 4px;
    }
    
    .api-football-fixtures .away-team .team-logo {
        margin-left: 3px;
        margin-right: 0;
    }
    
    .api-football-fixtures .team-name {
        font-size: 10px;
        max-width: 70px;
    }
    
    .api-football-fixtures .match-info {
        flex: 0 0 35px;
        margin: 0 6px;
    }
    
    .api-football-fixtures .match-info .vs {
        font-size: 10px;
    }
    
    .api-football-fixtures .match-info .score {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    /* Mobile-first approach for very small screens */
    .api-football-widget {
        margin: 15px 0;
        border-radius: 6px;
    }
    
    /* Compact standings - keep table format but optimize */
    .api-football-standings .api-football-table {
        font-size: 13px;
    }
    
    .api-football-standings .standings-table th,
    .api-football-standings .standings-table td {
        padding: 10px 6px;
    }
    
    .api-football-standings .team-logo {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }
    
    .api-football-standings .team-name {
        font-size: 13px;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }
    
    /* Hide less important columns for compact view */
    .api-football-standings .standings-table .played,
    .api-football-standings .standings-table .wins {
        display: none;
    }
    
    /* Keep only essential: rank, team, points */
    .api-football-standings .standings-table .rank {
        width: 30px;
        font-size: 14px;
        font-weight: 700;
    }
    
    .api-football-standings .standings-table .points {
        width: 40px;
        font-size: 14px;
        font-weight: 700;
        text-align: center;
    }
    
    /* Fixtures mobile optimization */
    .api-football-fixtures .fixture-item {
        padding: 8px 10px;
        min-height: 35px;
    }
    
    .api-football-fixtures .fixture-date {
        flex: 0 0 55px;
        margin-right: 8px;
        min-width: 55px;
    }
    
    .api-football-fixtures .fixture-date .date {
        font-size: 9px;
    }
    
    .api-football-fixtures .fixture-date .time {
        font-size: 8px;
    }
    
    .api-football-fixtures .fixture-teams {
        gap: 8px;
    }
    
    .api-football-fixtures .team-logo {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }
    
    .api-football-fixtures .team-name {
        font-size: 13px;
    }
    
    .api-football-fixtures .match-info {
        margin: 0 0 6px 0;
        text-align: left;
    }
    
    .api-football-fixtures .match-info .vs {
        font-size: 14px;
        font-weight: 600;
    }
    
    .api-football-fixtures .match-info .score {
        font-size: 16px;
        font-weight: 700;
    }
    
    /* Full page widgets - use card layout */
    .api-football-standings-full .api-football-table,
    .api-football-schedule .api-football-table,
    .api-football-results-full .api-football-table,
    .api-football-table:not(.standings-table):not(.api-football-fixtures .api-football-table),
    .api-football-table thead,
    .api-football-table tbody,
    .api-football-table th,
    .api-football-table td,
    .api-football-table tr {
        display: block;
    }
    
    .api-football-standings-full .api-football-table thead tr,
    .api-football-schedule .api-football-table thead tr,
    .api-football-results-full .api-football-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .api-football-standings-full .api-football-table tr,
    .api-football-schedule .api-football-table tr,
    .api-football-results-full .api-football-table tr {
        border: 1px solid #e0e0e0;
        margin-bottom: 8px;
        padding: 12px;
        border-radius: 6px;
        background: #fafafa;
    }
    
    .api-football-standings-full .api-football-table td,
    .api-football-schedule .api-football-table td,
    .api-football-results-full .api-football-table td {
        border: none;
        position: relative;
        padding-left: 45%;
        padding-bottom: 6px;
        padding-top: 6px;
        padding-right: 8px;
    }
    
    .api-football-standings-full .api-football-table td:before,
    .api-football-schedule .api-football-table td:before,
    .api-football-results-full .api-football-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 8px;
        width: 40%;
        padding-right: 8px;
        white-space: nowrap;
        font-weight: 600;
        color: #333;
        font-size: 12px;
    }
    
    /* Don't apply card layout to fixtures list */
    .fixtures-list .api-football-table,
    .fixtures-list .api-football-table thead,
    .fixtures-list .api-football-table tbody,
    .fixtures-list .api-football-table th,
    .fixtures-list .api-football-table td,
    .fixtures-list .api-football-table tr {
        display: table;
        position: static;
        border: none;
        margin: 0;
        padding: 0;
        background: transparent;
    }
}

/* Ultra-small screens (less than 360px) */
@media (max-width: 360px) {
    .api-football-standings .team-name {
        max-width: 80px;
    }
    
    .api-football-fixtures .team-name {
        font-size: 12px;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .api-football-fixtures .fixture-item {
        padding: 10px;
    }
}

/* Accessibility improvements */
.api-football-table:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.fixture-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* Print styles */
@media print {
    .api-football-widget {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .api-football-table thead {
        background: #000 !important;
        color: #fff !important;
    }
    
    .position-top,
    .position-europe,
    .position-relegation {
        background: transparent !important;
        border-left: 2px solid #000 !important;
    }
} 