/* /webpages/assets/css/webpage-viewer.css */

/*
 * MunicipalPost - Webpage Viewer
 *
 * Estilos para:
 * - /webpages/viewer.php
 *
 * Viewer interno tipo Facebook:
 * - Barra superior fija
 * - Iframe full screen
 * - Fallback elegante
 */

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f5f7;
    color: #111827;
}

body {
    overflow: hidden;
}

.mp-viewer {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f4f5f7;
}

.mp-viewer-topbar {
    height: 58px;
    min-height: 58px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 12px;
    box-sizing: border-box;
    z-index: 20;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.mp-viewer-left,
.mp-viewer-center,
.mp-viewer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mp-viewer-left {
    flex: 0 0 auto;
}

.mp-viewer-center {
    flex: 1 1 auto;
    justify-content: center;
    overflow: hidden;
    text-align: center;
}

.mp-viewer-right {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.mp-viewer-brand {
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
}

.mp-viewer-title-wrap {
    min-width: 0;
    overflow: hidden;
}

.mp-viewer-title {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}

.mp-viewer-subtitle {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
    margin-top: 2px;
}

.mp-viewer-btn {
    border: 0;
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
    white-space: nowrap;
}

.mp-viewer-btn-dark {
    background: #111827;
    color: #fff;
}

.mp-viewer-btn-dark:hover {
    background: #030712;
}

.mp-viewer-btn-light {
    background: #eef2f7;
    color: #111827;
}

.mp-viewer-btn-light:hover {
    background: #dbe5f3;
}

.mp-viewer-btn-link {
    background: transparent;
    color: #1d4ed8;
    padding-left: 6px;
    padding-right: 6px;
}

.mp-viewer-btn-link:hover {
    text-decoration: underline;
}

.mp-viewer-frame-area {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #ffffff;
}

.mp-viewer-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

.mp-viewer-fallback {
    height: 100%;
    overflow: auto;
    box-sizing: border-box;
    padding: 22px;
    background: #f4f5f7;
}

.mp-viewer-fallback-card {
    max-width: 860px;
    margin: 22px auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.08);
    overflow: hidden;
}

.mp-viewer-fallback-image {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    display: block;
    background: #e5e7eb;
}

.mp-viewer-fallback-body {
    padding: 22px;
}

.mp-viewer-fallback-kicker {
    color: #2563eb;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}

.mp-viewer-fallback-title {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.2;
    color: #111827;
}

.mp-viewer-fallback-desc {
    color: #4b5563;
    line-height: 1.55;
    margin: 0 0 14px;
    font-size: 16px;
}

.mp-viewer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.mp-viewer-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    background: #eef2ff;
    color: #3730a3;
}

.mp-viewer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.mp-viewer-notice {
    position: absolute;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    background: rgba(17,24,39,0.92);
    color: #fff;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 700;
    z-index: 15;
    box-shadow: 0 8px 25px rgba(0,0,0,0.18);
}

.mp-viewer-hidden {
    display: none !important;
}

.mp-viewer-message {
    background: #eff6ff;
    color: #1e3a8a;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 14px;
    line-height: 1.45;
}

.mp-viewer-message-success {
    background: #ecfdf5;
    color: #065f46;
}

.mp-viewer-message-warning {
    background: #fff7ed;
    color: #9a3412;
}

.mp-viewer-message-error {
    background: #fee2e2;
    color: #7f1d1d;
}

/*
 * Estados opcionales por JS
 */
.mp-viewer.is-loading .mp-viewer-frame-area::before {
    content: "Cargando vista interna...";
    position: absolute;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    background: rgba(17,24,39,0.92);
    color: #fff;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 8px 25px rgba(0,0,0,0.18);
}

.mp-viewer.is-fallback .mp-viewer-frame {
    display: none;
}

/*
 * Ajustes para móviles
 */
@media (max-width: 720px) {
    .mp-viewer-topbar {
        height: 56px;
        min-height: 56px;
        padding: 0 8px;
    }

    .mp-viewer-brand {
        display: none;
    }

    .mp-viewer-title {
        max-width: 170px;
        font-size: 13px;
    }

    .mp-viewer-subtitle {
        max-width: 170px;
    }

    .mp-viewer-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .mp-viewer-btn-hide-mobile {
        display: none;
    }

    .mp-viewer-fallback {
        padding: 12px;
    }

    .mp-viewer-fallback-card {
        margin: 12px auto;
        border-radius: 16px;
    }

    .mp-viewer-fallback-title {
        font-size: 22px;
    }

    .mp-viewer-fallback-desc {
        font-size: 15px;
    }

    .mp-viewer-fallback-body {
        padding: 16px;
    }

    .mp-viewer-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .mp-viewer-actions .mp-viewer-btn {
        width: 100%;
        box-sizing: border-box;
    }

    .mp-viewer-notice {
        max-width: calc(100vw - 24px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/*
 * Ajuste extra para pantallas muy angostas
 */
@media (max-width: 420px) {
    .mp-viewer-title {
        max-width: 130px;
    }

    .mp-viewer-subtitle {
        max-width: 130px;
    }

    .mp-viewer-left,
    .mp-viewer-right {
        gap: 5px;
    }

    .mp-viewer-btn {
        padding: 8px 9px;
    }
}

/*
 * Modo oscuro básico
 */
@media (prefers-color-scheme: dark) {
    html,
    body,
    .mp-viewer,
    .mp-viewer-fallback {
        background: #030712;
        color: #f9fafb;
    }

    .mp-viewer-topbar {
        background: #111827;
        border-bottom-color: rgba(255,255,255,0.08);
        box-shadow: 0 2px 12px rgba(0,0,0,0.28);
    }

    .mp-viewer-brand,
    .mp-viewer-title {
        color: #f9fafb;
    }

    .mp-viewer-subtitle {
        color: #d1d5db;
    }

    .mp-viewer-btn-light {
        background: #1f2937;
        color: #f9fafb;
    }

    .mp-viewer-btn-light:hover {
        background: #374151;
    }

    .mp-viewer-frame-area {
        background: #111827;
    }

    .mp-viewer-fallback-card {
        background: #111827;
        box-shadow: 0 10px 35px rgba(0,0,0,0.35);
    }

    .mp-viewer-fallback-title {
        color: #f9fafb;
    }

    .mp-viewer-fallback-desc {
        color: #d1d5db;
    }

    .mp-viewer-pill {
        background: #1f2937;
        color: #dbeafe;
    }
}