body {
    font-family: Arial, sans-serif;
    background: #f6f7fc;
    margin: 0;
    padding: 0;
}
h1 {
    text-align: center;
}

#btnSubir {
  background: #333;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 1000;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}
.search-area {
    text-align: center;
    margin-bottom: 25px;
}
.search-input {
    border: 1px solid #b7c2df;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 1em;
    width: 90%;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 2px 2px 0 #f2f4fa;
}
.canal {
    background: #fff;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 6px #ddd;
    padding: 20px;
    display: flex;
    flex-direction: row;
    gap: 18px;
    align-items: flex-start;
}
.canal-logo img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: #e5e5e5;
    display: block;
}
.canal-info {
    flex: 1;
    min-width: 0;
}
.search-btn:active {
    background:#273a7c;
}
.canal-nome {
    font-size: 1.2em;
    font-weight: bold;
    color: #1d1d27;
    margin-bottom: 8px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.agora {
    background: #e9f0ff;
    border-left: 6px solid #3e59bc;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.agora .titulo {
    font-size: 1.1em;
    font-weight: bold;
    color: #1d1d27;
}
.agora .desc {
    color: #333;
    font-size: 0.97em;
    margin-top: 4px;
}
.agora .horario {
    color: #7580a1;
    font-size: 0.92em;
}
.collapsible-btn {
    background: #f1f4fa;
    color: #3657be;
    border: none;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 6px;
    width: 100%;
    text-align: left;
    font-size: 1em;
    margin-bottom: 2px;
    transition: background 0.2s;
    font-weight: 500;
    box-shadow: 0 1px 2px #eee;
    display: flex;
    align-items: center;
    gap: 6px;
}
.collapsible-btn[aria-expanded="true"] {
    background: #dce8ff;
}
.collapsible-btn .arrow {
    transition: transform 0.3s;
    display: inline-block;
}
.collapsible-btn[aria-expanded="true"] .arrow {
    transform: rotate(90deg);
}
.col-content {
    max-height: 0;
    overflow: hidden;
    background: #f6f7fc;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 1px 2px #eee;
    transition: max-height 0.3s ease;
}
.col-content.open {
    padding: 12px 5px 4px 5px;
    max-height: 1000px;
}
.proximos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.proximo {
    background: #fff;
    border-radius: 6px;
    padding: 8px 10px;
    min-width: 160px;
    flex: 1 1 190px;
    box-shadow: 0 1px 2px #eee;
    margin-bottom: 6px;
}
.proximo .titulo {
    font-weight: bold;
    color: #21355a;
}
.proximo .desc {
    font-size: 0.97em;
    margin: 2px 0;
    color: #393c44;
}
.proximo .horario {
    font-size: 0.92em;
    color: #7580a1;
}
@media (max-width: 700px) {
    .container {
        padding: 4px;
    }
    .canal {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    .canal-logo img {
        width: 52px;
        height: 52px;
    }
    .canal-logo {
        margin-bottom: 10px;
    }
    .proximo {
        min-width: 120px;
        max-width: 100%;
    }
    .search-input {
        width: 98%;
        font-size:1em;
    }
}
/* ...seus estilos atuais... */
.progresso {
    height: 10px;
    background: #dee7f6;
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    position: relative;
}
.progresso-inner {
    background: linear-gradient(90deg, #39c7a5, #3e59bc 100%);
    height: 100%;
    border-radius: 8px;
    transition: width .4s;
    width: 0;
}
.progresso-text {
    font-size: 0.93em;
    color: #3e59bc;
    text-align: right;
    margin-top: 2px;
    font-weight: bold;
}
@media (max-width: 700px) {
    .col-content.open {
        max-height: unset !important;
        padding-bottom: 0;
    }
    .proximos {
        max-height: 220px !important; /* ou quanto quiser */
        overflow-y: auto;
        display: block; /* melhor comportamento para empilhar */
    }
}

@media (max-width: 700px) {
    .search-area {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    #form-busca {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    .search-input,
    .search-btn,
    .reset-btn {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }
}

.loader {
    border: 4px solid #e0e6f2;
    border-top: 4px solid #3657be;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    animation: spin 1s linear infinite;
    margin: 32px auto 12px auto;
    display: block;
}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Timeline Styles */
.timeline-container {
    margin: 12px 0;
    padding: 10px 0;
}

.timeline-bar {
    position: relative;
    height: 60px;
    background: linear-gradient(to right, #e3e8f0 0%, #c8d4e8 50%, #e3e8f0 100%);
    border-radius: 8px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.timeline-start,
.timeline-end {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85em;
    font-weight: bold;
    color: #5a6c8f;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.timeline-start {
    left: 10px;
}

.timeline-end {
    right: 10px;
}

.timeline-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    transform: translateX(-50%);
    z-index: 10;
}

.timeline-marker.current-time .marker-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    background: linear-gradient(to bottom, #ff4757, #ff6b81);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.6);
    animation: pulse-line 2s ease-in-out infinite;
}

.timeline-marker.current-time .marker-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4757;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.4);
    animation: pulse-label 2s ease-in-out infinite;
}

@keyframes pulse-line {
    0%, 100% {
        box-shadow: 0 0 8px rgba(255, 71, 87, 0.6);
        width: 4px;
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 71, 87, 0.9);
        width: 5px;
    }
}

@keyframes pulse-label {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(255, 71, 87, 0.4);
    }
    50% {
        box-shadow: 0 3px 8px rgba(255, 71, 87, 0.7);
    }
}

.program-header {
    margin-bottom: 10px;
}

.program-header .horario {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Responsive Timeline */
@media (max-width: 700px) {
    .timeline-bar {
        height: 50px;
    }
    
    .timeline-start,
    .timeline-end {
        font-size: 0.75em;
        padding: 3px 6px;
    }
    
    .timeline-marker.current-time .marker-label {
        font-size: 0.7em;
        padding: 1px 6px;
    }
}

/* ============================================
   EPG GRID VIEW (Visualização em Grade)
   ============================================ */

.epg-grid-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: auto;
    overflow-y: auto;
    max-height: 800px;
}

.epg-grid-header {
    display: flex;
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    border-bottom: 2px solid #3657be;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.epg-channel-column {
    width: 200px;
    min-width: 200px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
    position: sticky;
    left: 0;
    z-index: 50;
}

.epg-header-label {
    padding: 15px;
    font-weight: bold;
    font-size: 1.1em;
    color: #3657be;
    text-align: center;
}

.epg-timeline-container {
    flex: 1;
    position: relative;
    min-width: 720px;
}

.epg-timeline {
    display: flex;
    background: linear-gradient(to bottom, #e9ecef 0%, #f8f9fa 100%);
}

.epg-time-slot {
    border-right: 1px solid #dee2e6;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

.epg-current-time-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    z-index: 90;
    pointer-events: none;
}

.epg-time-line {
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #dc3545, #ff6b81);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.6);
    animation: pulse-grid-line 2s ease-in-out infinite;
}

@keyframes pulse-grid-line {
    0%, 100% {
        box-shadow: 0 0 10px rgba(220, 53, 69, 0.6);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 20px rgba(220, 53, 69, 0.9);
        opacity: 0.8;
    }
}

.epg-grid-body {
    display: flex;
    flex-direction: column;
}

.epg-grid-row {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    min-height: 80px;
    transition: background-color 0.2s;
}

.epg-grid-row:hover {
    background-color: #f8f9fa;
}

.epg-channel-info {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 10px;
    height: 100%;
}

.epg-channel-logo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #e9ecef;
}

.epg-channel-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #212529;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.epg-programs-container {
    position: relative;
    height: 100%;
    min-height: 80px;
}

.epg-program-block {
    position: absolute;
    top: 5px;
    height: 70px;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Programas futuros - simplificados */
.epg-program-block.future {
    background: linear-gradient(135deg, #cbd5e0 0%, #a0aec0 100%);
    height: 50px;
    top: 15px;
    opacity: 0.7;
    border: 1px solid #e2e8f0;
}

.epg-program-block.future:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Programas ao vivo - destaque total */
.epg-program-block.live {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: 2px solid #fff;
    height: 70px;
    top: 5px;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.6);
    animation: pulse-live-block 2s ease-in-out infinite;
    z-index: 20;
}

.epg-program-block.live:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 25px rgba(40, 167, 69, 0.8);
}

@keyframes pulse-live-block {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(40, 167, 69, 0.6);
    }
    50% {
        box-shadow: 0 6px 30px rgba(40, 167, 69, 0.9);
    }
}

/* Indicador AO VIVO */
.epg-live-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7em;
    font-weight: bold;
    color: white;
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 4px;
    width: fit-content;
}

.epg-live-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.epg-program-title {
    font-weight: 600;
    font-size: 0.85em;
    color: white;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.epg-program-time {
    font-size: 0.75em;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

/* Horário simples para programas futuros */
.epg-program-time-simple {
    font-size: 0.8em;
    color: #4a5568;
    font-weight: 600;
    text-align: center;
    padding-top: 12px;
}

/* Barra de progresso do programa ao vivo */
.epg-program-progress {
    margin-top: 6px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.epg-progress-bar {
    height: 100%;
    background: white;
    border-radius: 2px;
    transition: width 1s ease;
    box-shadow: 0 0 8px rgba(255,255,255,0.8);
}

/* Responsive Grid View */
@media (max-width: 768px) {
    .epg-channel-column {
        width: 150px;
        min-width: 150px;
    }
    
    .epg-channel-logo {
        width: 40px;
        height: 40px;
    }
    
    .epg-channel-name {
        font-size: 0.8em;
    }
    
    .epg-time-slot {
        padding: 10px 5px;
        font-size: 0.8em;
    }
    
    .epg-program-block {
        height: 60px;
        padding: 6px;
    }
    
    .epg-program-title {
        font-size: 0.75em;
    }
    
    .epg-program-time {
        font-size: 0.7em;
    }
}