/* ==========================================================================
   GUIDA TV PRO - Styles
   ========================================================================== */

/* Wrapper */
.guidatv-pro-wrapper {
    background: #f5f5f5;
    min-height: 100vh;
    padding: 30px 0 60px;
}

.guidatv-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.guidatv-header {
    text-align: center;
    margin-bottom: 40px;
}

.guidatv-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0 0 10px;
}

.guidatv-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

/* Channels Grid */
.guidatv-channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
}

.guidatv-channel-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    border-radius: 12px;
    padding: 15px 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    border-left: 4px solid var(--channel-color, #8DC63F);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.guidatv-channel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.channel-number {
    width: 50px;
    height: 50px;
    background: var(--channel-color, #8DC63F);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 5px;
    color: #1a1a2e;
}

.channel-now {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.now-badge {
    background: #e53935;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    animation: pulse 2s infinite;
}

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

.now-title {
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.now-time {
    color: #888;
    font-size: 0.8rem;
}

.channel-arrow {
    color: #ccc;
    font-size: 1.5rem;
    transition: transform 0.2s;
}

.guidatv-channel-card:hover .channel-arrow {
    transform: translateX(5px);
    color: var(--channel-color, #8DC63F);
}

/* Breadcrumb */
.guidatv-breadcrumb {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}
.guidatv-breadcrumb a {
    color: #666;
    text-decoration: none;
}
.guidatv-breadcrumb a:hover {
    color: #8DC63F;
}
.guidatv-breadcrumb span {
    margin: 0 8px;
    color: #999;
}

/* Back Button */
.guidatv-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 25px;
    padding: 10px 0;
    transition: color 0.2s;
}

.guidatv-back:hover {
    color: #1a1a2e;
}

/* Channel Header */
.guidatv-channel-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, var(--channel-color) 0%, color-mix(in srgb, var(--channel-color) 80%, #000) 100%);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 25px;
    color: #fff;
}

.channel-number-big {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
}

.channel-header-info h1 {
    font-size: 2rem;
    margin: 0 0 5px;
    color: #fff;
}

.channel-header-info p {
    margin: 0;
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Channel Description SEO */
.guidatv-channel-desc {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid var(--channel-color, #8DC63F);
}
.guidatv-channel-desc p {
    margin: 0;
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Date Navigation */
.guidatv-date-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 5px 0 15px;
    margin-bottom: 15px;
    -webkit-overflow-scrolling: touch;
}

.date-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    color: #333;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.date-btn:hover {
    border-color: #8DC63F;
    color: #8DC63F;
}

.date-btn.active {
    background: #8DC63F;
    border-color: #8DC63F;
    color: #fff;
}

/* Fascia Navigation */
.guidatv-fascia-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.fascia-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.fascia-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.fascia-btn.active {
    background: #1a1a2e;
    border-color: #1a1a2e;
    color: #fff;
}

/* Programs List */
.programs-list {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.program-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.program-item:last-child {
    border-bottom: none;
}

.program-item:hover {
    background: #fafafa;
}

.program-item.on-air {
    background: linear-gradient(90deg, rgba(141, 198, 63, 0.1) 0%, transparent 100%);
    border-left: 4px solid #8DC63F;
}

.program-time {
    flex-shrink: 0;
    width: 70px;
    text-align: center;
}

.time-start {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a2e;
}

.time-end {
    display: block;
    font-size: 0.85rem;
    color: #999;
}

.program-info {
    flex: 1;
    min-width: 0;
}

.program-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-badge {
    background: #e53935;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    animation: pulse 2s infinite;
}

.program-desc {
    color: #666;
    font-size: 0.95rem;
    margin: 0 0 8px;
    line-height: 1.5;
}

.program-more {
    background: none;
    border: none;
    color: #8DC63F;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
}

.program-more:hover {
    text-decoration: underline;
}

/* No Programs */
.guidatv-no-programs {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 16px;
    color: #666;
    font-size: 1.1rem;
}

/* Modal */
.guidatv-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.guidatv-modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #e0e0e0;
}

.modal-body {
    padding: 30px;
}

.modal-body h3 {
    font-size: 1.3rem;
    margin: 0 0 10px;
    color: #1a1a2e;
    padding-right: 40px;
}

.modal-body .modal-time {
    color: #8DC63F;
    font-weight: 600;
    margin-bottom: 15px;
}

.modal-body .modal-desc {
    color: #555;
    line-height: 1.7;
    font-size: 1rem;
}

/* Disclaimer */
.guidatv-disclaimer {
    text-align: center;
    padding: 30px 20px;
    color: #999;
}

/* View All Button */
.guidatv-view-all {
    text-align: center;
    margin-top: 25px;
}

.guidatv-btn {
    display: inline-block;
    padding: 12px 30px;
    background: #8DC63F;
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.2s;
}

.guidatv-btn:hover {
    background: #7ab535;
    transform: translateY(-2px);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .guidatv-pro-wrapper {
        padding: 15px 0 40px;
    }
    
    .guidatv-header h1 {
        font-size: 1.8rem;
    }
    
    .guidatv-channels-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .guidatv-channel-card {
        padding: 12px 15px;
    }
    
    .channel-number {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .channel-name {
        font-size: 1rem;
    }
    
    .now-title {
        max-width: 100px;
    }
    
    .guidatv-channel-header {
        padding: 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .channel-logo-big {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .channel-header-info h1 {
        font-size: 1.5rem;
    }
    
    .date-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .fascia-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .program-item {
        padding: 15px;
        gap: 15px;
    }
    
    .program-time {
        width: 55px;
    }
    
    .time-start {
        font-size: 1rem;
    }
    
    .program-title {
        font-size: 1rem;
        flex-wrap: wrap;
    }
    
    .program-desc {
        font-size: 0.9rem;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body.dark-mode .guidatv-pro-wrapper {
        background: #1a1a2e;
    }
    
    body.dark-mode .guidatv-channel-card,
    body.dark-mode .programs-list,
    body.dark-mode .date-btn,
    body.dark-mode .fascia-btn {
        background: #252540;
        border-color: #3a3a5a;
    }
    
    body.dark-mode .channel-name,
    body.dark-mode .program-title,
    body.dark-mode .time-start,
    body.dark-mode .guidatv-header h1 {
        color: #fff;
    }
    
    body.dark-mode .program-desc,
    body.dark-mode .guidatv-subtitle,
    body.dark-mode .now-title {
        color: #aaa;
    }
    
    body.dark-mode .modal-content {
        background: #252540;
    }
    
    body.dark-mode .modal-body h3 {
        color: #fff;
    }
    
    body.dark-mode .modal-body .modal-desc {
        color: #ccc;
    }
}

/* =========================================================================
   THUMBNAIL PROGRAMMI (XMLTV <icon> dentro <programme>)
   Mostra la locandina/poster del programma se presente nel feed.
   ========================================================================= */

.program-item.has-thumb {
    /* Garantisco che il flex layout esistente accolga il thumb senza rompersi */
    align-items: stretch;
}

.program-thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.program-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 600px) {
    .program-thumb {
        width: 60px;
        height: 60px;
    }
}

@media (prefers-color-scheme: dark) {
    body.dark-mode .program-thumb {
        background: #2a2a40;
    }
}


/* Thumbnail nel popup/modal del programma */
.modal-body .modal-thumb {
    width: 100%;
    max-height: 280px;
    margin: 0 0 18px;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body .modal-thumb img {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: cover;
    display: block;
}

@media (max-width: 600px) {
    .modal-body .modal-thumb {
        max-height: 200px;
        margin-bottom: 14px;
        border-radius: 8px;
    }
    .modal-body .modal-thumb img {
        max-height: 200px;
    }
}

@media (prefers-color-scheme: dark) {
    body.dark-mode .modal-body .modal-thumb {
        background: #2a2a40;
    }
}

/* =========================================================================
   PAGINE STASERA IN TV / ORA IN TV (Fase 3)
   ========================================================================= */

.guidatv-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0 32px;
    justify-content: center;
}
.guidatv-dates .date-pill {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
    transition: all .2s;
}
.guidatv-dates .date-pill:hover {
    background: #f5f5f5;
    border-color: #bbb;
}
.guidatv-dates .date-pill.active {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
    font-weight: 600;
}

/* Stasera in TV grid */
.stasera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.stasera-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    border-left: 4px solid var(--channel-color, #8DC63F);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stasera-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,.1);
}
.stasera-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.stasera-lcn {
    background: var(--channel-color, #8DC63F);
    color: #fff;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .85rem;
    min-width: 38px;
    text-align: center;
}
.stasera-name {
    font-weight: 600;
    color: #1a1a2e;
}
.stasera-prog.primary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stasera-prog.primary .stasera-time {
    font-size: .8rem;
    font-weight: 600;
    color: var(--channel-color, #8DC63F);
    letter-spacing: .05em;
}
.stasera-prog.primary .stasera-title {
    font-size: 1.05rem;
    color: #1a1a2e;
    line-height: 1.3;
}
.stasera-prog.primary .stasera-desc {
    font-size: .85rem;
    color: #666;
    line-height: 1.4;
}
.stasera-prog.secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
    font-size: .85rem;
    color: #555;
}
.stasera-prog.secondary .stasera-time {
    font-weight: 600;
    color: #888;
}

/* Ora in TV grid */
.ora-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-top: 24px;
}
.ora-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    border-left: 4px solid var(--channel-color, #8DC63F);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .2s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ora-card:hover {
    transform: translateY(-2px);
}
.ora-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
}
.ora-lcn {
    background: var(--channel-color, #8DC63F);
    color: #fff;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    min-width: 32px;
    text-align: center;
}
.ora-name {
    font-weight: 600;
    color: #1a1a2e;
    flex: 1;
}
.ora-live {
    color: #e53935;
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: .05em;
}
.ora-now {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ora-time {
    font-size: .75rem;
    font-weight: 600;
    color: var(--channel-color, #8DC63F);
}
.ora-title {
    font-size: 1rem;
    color: #1a1a2e;
    line-height: 1.3;
}
.ora-next {
    padding-top: 8px;
    border-top: 1px dashed #eee;
    font-size: .8rem;
    color: #777;
}
.ora-next-label {
    color: #999;
}
.ora-next-title {
    color: #555;
    font-weight: 500;
}

/* Sub-nav nelle pagine guida-tv */
.guidatv-subnav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 16px 0 28px;
}
.guidatv-subnav a {
    background: #fff;
    color: #1a1a2e;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid #e0e0e0;
    transition: all .2s;
    font-size: .9rem;
}
.guidatv-subnav a:hover {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}
.guidatv-subnav a.active {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

@media (max-width: 600px) {
    .stasera-grid, .ora-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .stasera-card, .ora-card {
        padding: 12px;
    }
    .guidatv-subnav a {
        padding: 8px 14px;
        font-size: .85rem;
    }
}

@media (prefers-color-scheme: dark) {
    body.dark-mode .stasera-card,
    body.dark-mode .ora-card,
    body.dark-mode .guidatv-subnav a {
        background: #252540;
        color: #fff;
    }
    body.dark-mode .stasera-name,
    body.dark-mode .stasera-prog.primary .stasera-title,
    body.dark-mode .ora-name,
    body.dark-mode .ora-title {
        color: #fff;
    }
    body.dark-mode .stasera-prog.primary .stasera-desc,
    body.dark-mode .stasera-prog.secondary,
    body.dark-mode .ora-next,
    body.dark-mode .ora-next-title {
        color: #aaa;
    }
}
