/* =====================================================================
   portal.css — HOME do Portal Minas
   Layout igual às páginas internas + ÚLTIMA HORA + PLAYER DA RÁDIO
   ===================================================================== */

/* ---------- RESET ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    padding: 20px;
    padding-top: 115px;
    background-color: #f0f2f5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: #0056b3; text-decoration: none; }

/* ---------- HEADER ---------- */
.page-header {
    background-color: #0d47a1;
    padding: 0 20px;
    text-align: center;
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.page-header .header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.page-header .header-logo img {
    max-height: 70px;
    max-width: 220px;
    width: auto;
    height: auto;
    display: block;
}

/* =========================================================
   ÚLTIMA HORA
   ========================================================= */

.ultima-hora {
    max-width: 950px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    overflow: hidden;
    border-left: 4px solid #d32f2f;
    height: 44px;
}

.uh-tag {
    flex-shrink: 0;
    background: #d32f2f;
    color: #fff;
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    animation: uhPulse 1.8s ease-in-out infinite;
}

@keyframes uhPulse {
    0%, 100% { background: #d32f2f; }
    50%      { background: #ff4d4d; }
}

.uh-track {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.uh-track::before,
.uh-track::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 30px;
    z-index: 2;
    pointer-events: none;
}
.uh-track::before {
    left: 0;
    background: linear-gradient(to right, #fff, transparent);
}
.uh-track::after {
    right: 0;
    background: linear-gradient(to left, #fff, transparent);
}

.uh-content {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
    height: 100%;
    padding-left: 14px;
    /* duração controlada por PHP via style inline; fallback 12s */
    animation: uhScroll 12s linear infinite;
    will-change: transform;
}

.ultima-hora:hover .uh-content {
    animation-play-state: paused;
}

@keyframes uhScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.uh-item {
    color: #333;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}
.uh-item:hover {
    color: #d32f2f;
}

.uh-sep {
    color: #d32f2f;
    font-weight: bold;
    font-size: 0.9rem;
}

/* ---------- NAV ---------- */
.portal-nav {
    max-width: 950px;
    margin: 0 auto 15px;
    display: flex;
    gap: 6px;
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}
.portal-nav a {
    flex: 1;
    text-align: center;
    padding: 10px 14px;
    border-radius: 6px;
    color: #0056b3;
    font-weight: bold;
    font-size: 0.95rem;
    transition: 0.2s;
    border: 2px solid transparent;
    min-width: 90px;
}
.portal-nav a:hover,
.portal-nav a.ativo {
    background: #0056b3;
    color: #fff;
}

/* ---------- CONTAINER ---------- */
.container {
    max-width: 950px;
    width: 100%;
    margin: 20px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ---------- HERO ---------- */
.hero-home {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.hero-link { position: relative; display: block; }
.hero-link img {
    width: 100%;
    aspect-ratio: 16/8;
    object-fit: cover;
    transition: transform 0.3s;
}
.hero-link:hover img { transform: scale(1.02); }
.hero-info {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 60px 24px 22px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.15) 70%, transparent);
    color: #fff;
}
.hero-info .badge {
    display: inline-block;
    background: #d32f2f;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.hero-info h1 {
    color: #fff;
    font-size: clamp(1.1rem, 2.6vw, 1.8rem);
    line-height: 1.25;
    text-transform: none;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    font-weight: bold;
}
.hero-info .data {
    display: block;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #cfd6dd;
}

/* ---------- BLOCOS ---------- */
.bloco { margin-bottom: 40px; }
.bloco:last-child { margin-bottom: 0; }

.secao-titulo {
    color: #0056b3;
    font-size: 1.4rem;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 3px solid #0056b3;
    letter-spacing: 0.5px;
}

/* ---------- GRID ---------- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid-videos { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ---------- CARD ---------- */
.card-noticia {
    display: block;
    background: #fff;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    overflow: hidden;
    color: #333;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.card-noticia:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: #0056b3;
}
.card-noticia img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #dfe3e8;
}
.card-txt { padding: 12px 14px 16px; }
.card-txt h3 {
    color: #0056b3;
    font-size: 0.95rem;
    line-height: 1.35;
    font-weight: bold;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-txt .data {
    font-size: 0.75rem;
    color: #777;
}

/* ---------- VIDEO CARD ---------- */
.video-card .thumb-wrap { position: relative; }
.video-card .play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 48px;
    background: rgba(211,47,47,0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    padding-left: 3px;
    box-shadow: 0 6px 20px rgba(211,47,47,0.5);
    transition: transform 0.2s;
}
.video-card:hover .play { transform: translate(-50%, -50%) scale(1.1); }

/* ---------- VER MAIS ---------- */
.ver-mais {
    text-align: center;
    margin-top: 22px;
}
.ver-mais a {
    display: inline-block;
    padding: 12px 26px;
    background-color: #fff;
    border: 2px solid #0056b3;
    color: #0056b3;
    font-weight: bold;
    border-radius: 8px;
    transition: 0.3s;
}
.ver-mais a:hover {
    background-color: #0056b3;
    color: #fff;
}

/* ---------- AVISO ---------- */
.aviso {
    text-align: center;
    padding: 40px 20px;
    color: #777;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 8px;
    font-size: 1rem;
}
.aviso code {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    color: #d32f2f;
    font-size: 0.9rem;
}

/* ---------- FOOTER ---------- */
.page-footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid #ddd;
    font-size: 0.9em;
    color: #666;
    max-width: 950px;
    margin-left: auto;
    margin-right: auto;
}
.page-footer a {
    color: #0056b3;
    font-weight: bold;
}

/* =========================================================
   PLAYER DA RÁDIO
   ========================================================= */

.radio-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 900;
    background: linear-gradient(135deg, #1DB954 0%, #158f3f 100%);
    border: none;
    border-radius: 50px;
    padding: 10px 16px 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(29,185,84,0.5);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.25s;
    color: #fff;
}
.radio-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(29,185,84,0.7); }
.radio-fab:active { transform: scale(0.96); }
.radio-fab.oculto { opacity: 0; pointer-events: none; transform: translateY(20px); }

.radio-fab-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.radio-waves {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: 100%;
}
.radio-waves span {
    display: block;
    width: 2.5px;
    background: #fff;
    border-radius: 2px;
    height: 30%;
    transition: height 0.2s;
}
.radio-waves span:nth-child(1) { height: 30%; }
.radio-waves span:nth-child(2) { height: 55%; }
.radio-waves span:nth-child(3) { height: 80%; }
.radio-waves span:nth-child(4) { height: 55%; }
.radio-waves span:nth-child(5) { height: 30%; }

.radio-fab.tocando .radio-waves span:nth-child(1) { animation: ondaSom 0.9s ease-in-out infinite; animation-delay: 0s; }
.radio-fab.tocando .radio-waves span:nth-child(2) { animation: ondaSom 0.9s ease-in-out infinite; animation-delay: 0.15s; }
.radio-fab.tocando .radio-waves span:nth-child(3) { animation: ondaSom 0.9s ease-in-out infinite; animation-delay: 0.3s; }
.radio-fab.tocando .radio-waves span:nth-child(4) { animation: ondaSom 0.9s ease-in-out infinite; animation-delay: 0.15s; }
.radio-fab.tocando .radio-waves span:nth-child(5) { animation: ondaSom 0.9s ease-in-out infinite; animation-delay: 0s; }

@keyframes ondaSom {
    0%, 100% { height: 20%; }
    50%      { height: 85%; }
}

.radio-fab-label {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.radio-panel {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 901;
    width: 320px;
    max-width: calc(100vw - 36px);
    background: #1a1d24;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.radio-panel.aberto {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.radio-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.radio-panel-logo {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #0d47a1;
    object-fit: contain;
    padding: 4px;
    flex-shrink: 0;
}
.radio-panel-title { flex: 1; min-width: 0; }
.radio-panel-title strong {
    display: block;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.radio-panel-title small {
    display: block;
    color: #9aa3b2;
    font-size: 0.72rem;
    margin-top: 2px;
}
.radio-panel-close {
    background: none;
    border: none;
    color: #9aa3b2;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
}
.radio-panel-close:hover { color: #fff; }

.radio-panel-body {
    display: flex;
    gap: 12px;
    padding: 14px 12px;
    align-items: center;
}
.radio-panel-play {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #1DB954;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(29,185,84,0.5);
    transition: transform 0.15s;
    flex-shrink: 0;
}
.radio-panel-play:active { transform: scale(0.94); }
.radio-panel-play svg { width: 24px; height: 24px; }

.radio-panel-controls { flex: 1; min-width: 0; }
.radio-panel-vol-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.radio-panel-vol-icon { font-size: 0.95rem; }
.radio-panel-vol {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    outline: none;
    cursor: pointer;
}
.radio-panel-vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #1DB954;
    cursor: pointer;
    border: 2px solid #fff;
}
.radio-panel-vol::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #1DB954;
    cursor: pointer;
    border: 2px solid #fff;
}
.radio-panel-link {
    font-size: 0.72rem;
    color: #9aa3b2;
    text-decoration: none;
    font-weight: 600;
}
.radio-panel-link:hover { color: #1DB954; }

/* =====================================================================
   RESPONSIVO
   ===================================================================== */

@media (max-width: 768px) {
    body { padding: 12px; padding-top: 100px; }
    .page-header { height: 80px; }
    .page-header .header-logo img { max-height: 60px; }
    .container { padding: 20px; margin: 15px auto; }
    .hero-info { padding: 50px 16px 18px; }
    .secao-titulo { font-size: 1.2rem; }
    .grid-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .grid-4 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .grid-videos { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
        padding-top: calc(90px + env(safe-area-inset-top));
    }
    .page-header {
        height: 72px;
        padding-top: env(safe-area-inset-top);
    }
    .page-header .header-logo img {
        max-height: 52px;
        max-width: 160px;
    }

    .container {
        padding: 14px;
        margin: 10px auto;
        border-radius: 8px;
    }

    .portal-nav { padding: 6px; gap: 4px; margin-bottom: 12px; }
    .portal-nav a {
        padding: 9px 8px;
        font-size: 0.82rem;
        border-radius: 5px;
        min-width: 70px;
    }

    .ultima-hora {
        height: 40px;
        border-radius: 6px;
        margin-bottom: 10px;
    }
    .uh-tag { font-size: 0.65rem; padding: 0 10px; }
    .uh-content {
        gap: 12px;
        padding-left: 12px;
    }
    .uh-item { font-size: 0.82rem; }

    .hero-home { margin-bottom: 22px; }
    .hero-link img { aspect-ratio: 4/3; }
    .hero-info { padding: 40px 12px 14px; }
    .hero-info h1 { font-size: 1.05rem; }
    .hero-info .badge { font-size: 0.65rem; padding: 2px 8px; }
    .hero-info .data { font-size: 0.75rem; margin-top: 6px; }

    .secao-titulo {
        font-size: 1.05rem;
        padding-bottom: 6px;
        margin-bottom: 14px;
    }

    .grid-3,
    .grid-4,
    .grid-videos {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .card-txt { padding: 12px 12px 14px; }
    .card-txt h3 {
        font-size: 0.95rem;
        -webkit-line-clamp: 3;
    }
    .card-txt .data { font-size: 0.72rem; }

    .video-card .play {
        width: 54px; height: 54px;
        font-size: 1.15rem;
    }

    .ver-mais a {
        display: block;
        width: 100%;
        padding: 14px;
        font-size: 0.95rem;
    }

    .page-footer { font-size: 0.8rem; padding: 16px 0; }

    /* Player da rádio no mobile */
    .radio-fab {
        right: 12px;
        bottom: 12px;
        padding: 8px 12px 8px 8px;
    }
    .radio-fab-icon { width: 34px; height: 34px; }
    .radio-fab-label { font-size: 0.72rem; }

    .radio-panel {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
}

@media (max-width: 360px) {
    body { padding-top: calc(80px + env(safe-area-inset-top)); }
    .page-header { height: 64px; }
    .page-header .header-logo img { max-height: 44px; max-width: 130px; }
    .hero-info h1 { font-size: 0.95rem; }
    .hero-info { padding: 36px 10px 12px; }
    .card-txt h3 { font-size: 0.88rem; }
    .portal-nav a { font-size: 0.75rem; padding: 8px 6px; min-width: 60px; }

    .ultima-hora { height: 38px; }
    .uh-tag { font-size: 0.6rem; padding: 0 8px; }
    .uh-item { font-size: 0.78rem; }
}

@media (display-mode: standalone) {
    body {
        padding-top: calc(105px + env(safe-area-inset-top));
        padding-bottom: env(safe-area-inset-bottom);
    }
    .page-header { padding-top: env(safe-area-inset-top); }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .uh-content { animation: none; }
}