/* IHI TV Frontend Styles */

.ihi-tv-data {
    clear: both;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.ihi-tv-header{
    display:flex;
    justify-content: space-between;
    align-items: center;
}

.ihi-tv-header h2{
  margin:0;
}

.ihi-tv-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Default Template */
.ihi-tv-default .ihi-tv-json {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.4;
}

/* List Template */
.ihi-tv-list .ihi-tv-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ihi-tv-list .ihi-tv-list-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ihi-tv-list .ihi-tv-list-item:last-child {
    margin-bottom: 0;
}

.ihi-tv-list .ihi-tv-list-item h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.ihi-tv-list .ihi-tv-list-item p {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

/* Grid Template */
.ihi-tv-grid .ihi-tv-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 0;
}

.ihi-tv-grid .ihi-tv-grid-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.ihi-tv-grid .ihi-tv-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ihi-tv-grid .ihi-tv-grid-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.ihi-tv-grid .ihi-tv-grid-item h3 {
    margin: 15px 15px 10px 15px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.ihi-tv-grid .ihi-tv-grid-item p {
    margin: 0 15px 15px 15px;
    color: #666;
    line-height: 1.4;
    font-size: 14px;
}

/* Table Template */
.ihi-tv-table {
    overflow-x: auto;
}

.ihi-tv-table .ihi-tv-table-element {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ihi-tv-table .ihi-tv-table-element th,
.ihi-tv-table .ihi-tv-table-element td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.ihi-tv-table .ihi-tv-table-element th {
    background: #f8f9fa;
    font-weight: bold;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.ihi-tv-table .ihi-tv-table-element tr:hover td {
    background: #f8f9fa;
}

.ihi-tv-table .ihi-tv-table-element tr:last-child td {
    border-bottom: none;
}

/* Events/Games Template */
.ihi-tv-events .ihi-tv-events-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 10px 0;
}

.ihi-tv-event-card {
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
    display: block;
    color: inherit;
    text-decoration: none;
}

.ihi-tv-event-card:hover {
    border-color: #007cba;
    box-shadow: 0 6px 12px rgba(0, 124, 186, 0.15);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.event-competition {
    font-size: 15px;
    font-weight: 600;
    color: #007cba;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-align: center;
}

.event-competition .live-indicator {
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 6px;
    animation: pulse 2s infinite;
}

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

.event-datetime {
    font-size: 14px;
    color: #666;
    text-align: center;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.event-score {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    padding: 6px 6px;
    border-radius: 6px;
    display:flex;
    justify-content: space-between;
}

.event-score .home,
.event-score .away,
.event-score .seperator {
  width:33%;
}

.event-score .home,
.event-score .away{
  border:1px solid #DDD;
  border-radius:6px;
}

.event-live-status {
    font-size: 14px;
    font-weight: 600;
    color: #dc3545;
    text-align: center;
    padding: 6px 6px;
    background: #f8d7da;
    border: 1px solid #dc3545;
    border-radius: 6px;
    text-transform: uppercase;
    /* animation: pulse 2s infinite; */
}

.event-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.team-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.team-logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.team-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.team-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-short {
    font-weight: 700;
    font-size: 16px;
    color: #1a1a1a;
}

.team-full {
    font-size: 12px;
    color: #383838;
    line-height:1.2;
}

.team-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
}

.home-team .team-label {
    color: #2d8a2f;
}

.away-team .team-label {
    color: #d63384;
}

.vs-separator {
    font-size: 14px;
    font-weight: 700;
    color: #007cba;
    background: #f0f8ff;
    border: 2px solid #007cba;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ihi-tv-no-events {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ihi-tv-events .ihi-tv-events-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .ihi-tv-events .ihi-tv-events-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ihi-tv-data.ihi-tv-events {
        position: relative;
        height: 230px; /* Increased height to prevent cutoff */
        margin: 0; /* Remove top margin in mobile */
    }

    .ihi-tv-header{
      display:flex;
      justify-content: space-between;
      align-items: center;
      width:100%;
      clear:both;
    }

    .ihi-tv-header h2{
      margin:0;
    }
    
    .ihi-tv-events .ihi-tv-events-grid {
        position: absolute;
        top: 30px;
        left: 0;
        right: 0;
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 15px;
        padding: 0 15px;
        -webkit-overflow-scrolling: touch;
    }

    .ihi-tv-event-card {
        flex: 0 0 280px;
        max-width: 280px;
        min-width: 280px;
        padding: 15px;
        scroll-snap-align: start;
        box-sizing: border-box;
    }

    /* Hide scrollbar while keeping functionality */
    .ihi-tv-events .ihi-tv-events-grid::-webkit-scrollbar {
        display: none;
    }
    
    .ihi-tv-events .ihi-tv-events-grid {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .event-teams {
        gap: 8px;
    }

    .team-logo {
        width: 40px;
        height: 40px;
    }

    .vs-separator {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .team-short {
        font-size: 14px;
    }
    
    /* Add scroll indicator */
    .ihi-tv-events::after {
        content: "← Swipe to see more games →";
        display: block;
        text-align: center;
        font-size: 12px;
        color: #999;
        margin-top: 290px; /* Adjusted position for taller wrapper */
        font-style: italic;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ihi-tv-grid .ihi-tv-grid-container {
        grid-template-columns: 1fr;
    }
    
    .ihi-tv-table {
        font-size: 14px;
    }
    
    .ihi-tv-table .ihi-tv-table-element th,
    .ihi-tv-table .ihi-tv-table-element td {
        padding: 8px 10px;
    }
}