/* ==========================================================================
   MHB Growth Plugin — Frontend Styles
   ========================================================================== */

:root {
    --mhb-purple:  #9b72d4;
    --mhb-gold:    #c9a84c;
    --mhb-rose:    #c47ba8;
    --mhb-dark:    #07050f;
    --mhb-mid:     #1a1035;
    --mhb-light:   #e8e0f5;
    --mhb-radius:  10px;
    --mhb-shadow:  0 4px 20px rgba(0,0,0,.18);
}

/* ==========================================================================
   1. Barra de progreso
   ========================================================================== */
#mhb-progress-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(155, 114, 212, .2);
    z-index: 9999;
}
#mhb-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--mhb-purple), var(--mhb-rose));
    transition: width .1s linear;
}

/* ==========================================================================
   2. Badge tiempo de lectura
   ========================================================================== */
.mhb-reading-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(155, 114, 212, .12);
    border: 1px solid rgba(155, 114, 212, .3);
    color: var(--mhb-purple);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 18px;
}

/* ==========================================================================
   3. Tabla de contenidos (TOC)
   ========================================================================== */
.mhb-toc {
    background: rgba(26, 16, 53, .06);
    border: 1px solid rgba(155, 114, 212, .25);
    border-left: 4px solid var(--mhb-purple);
    border-radius: var(--mhb-radius);
    padding: 16px 20px;
    margin: 0 0 28px;
    max-width: 640px;
}
.mhb-toc-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.mhb-toc-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--mhb-mid);
}
.mhb-toc-btn {
    background: none;
    border: 1px solid var(--mhb-purple);
    color: var(--mhb-purple);
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
}
.mhb-toc-btn:hover {
    background: var(--mhb-purple);
    color: #fff;
}
.mhb-toc-list {
    margin: 0;
    padding: 0 0 0 16px;
    list-style: none;
    overflow: hidden;
    transition: max-height .35s ease;
    max-height: 2000px;
}
.mhb-toc.collapsed .mhb-toc-list {
    max-height: 0;
}
.mhb-toc-list li {
    margin-bottom: 5px;
}
.mhb-toc-h2 { padding-left: 0; }
.mhb-toc-h3 { padding-left: 16px; }
.mhb-toc-list a {
    color: #555;
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.5;
    transition: color .2s;
}
.mhb-toc-list a:hover {
    color: var(--mhb-purple);
}
.mhb-toc-h3 a {
    font-size: 13px;
    opacity: .85;
}

/* ==========================================================================
   4. Botones de compartir
   ========================================================================== */
.mhb-share-wrap {
    margin: 32px 0;
    padding: 20px;
    background: rgba(155, 114, 212, .06);
    border-radius: var(--mhb-radius);
    border: 1px solid rgba(155, 114, 212, .2);
}
.mhb-share-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--mhb-mid);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.mhb-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mhb-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    transition: transform .2s, box-shadow .2s, opacity .2s;
    white-space: nowrap;
}
.mhb-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,.2);
    color: #fff;
}
.mhb-share-whatsapp  { background: #25D366; }
.mhb-share-telegram  { background: #0088cc; }
.mhb-share-twitter   { background: #1DA1F2; }
.mhb-share-facebook  { background: #1877F2; }
.mhb-share-pinterest { background: #E60023; }
.mhb-share-email     { background: var(--mhb-purple); }

/* Estilo minimal */
.mhb-share-style-minimal .mhb-share-btn .mhb-share-name { display: none; }
.mhb-share-style-minimal .mhb-share-btn { padding: 9px 12px; border-radius: 50%; }

/* Estilo pill */
.mhb-share-style-pill .mhb-share-btn { border-radius: 4px; }

/* ==========================================================================
   5. Tooltip frase destacada
   ========================================================================== */
#mhb-phrase-tooltip {
    position: absolute;
    transform: translateX(-50%) translateY(-100%);
    margin-top: -10px;
    background: var(--mhb-mid);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    gap: 6px;
    box-shadow: var(--mhb-shadow);
    z-index: 9999;
    white-space: nowrap;
}
#mhb-phrase-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--mhb-mid);
}
.mhb-tooltip-btn {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s;
}
.mhb-tooltip-btn:hover { background: rgba(255,255,255,.2); }
.mhb-tooltip-wa { border-color: #25D366; }
.mhb-tooltip-tw { border-color: #1DA1F2; }

/* ==========================================================================
   6. Sticky Share Bar (mobile)
   ========================================================================== */
#mhb-mobile-sticky-share {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--mhb-mid);
    padding: 10px 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 9998;
    box-shadow: 0 -2px 12px rgba(0,0,0,.3);
    transform: translateY(100%);
    transition: transform .35s ease;
}
#mhb-mobile-sticky-share.visible {
    transform: translateY(0);
}
.mhb-sticky-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-size: 22px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background .2s;
    line-height: 1;
}
.mhb-sticky-btn:hover { background: rgba(255,255,255,.1); }

@media (min-width: 769px) {
    #mhb-mobile-sticky-share { display: none !important; }
}

/* ==========================================================================
   7. Exit Intent Popup
   ========================================================================== */
.mhb-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 5, 15, .75);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.mhb-popup-overlay.show {
    display: flex;
}
.mhb-popup-box {
    background: linear-gradient(135deg, var(--mhb-dark) 0%, var(--mhb-mid) 100%);
    border: 1px solid rgba(155, 114, 212, .4);
    border-radius: 16px;
    padding: 36px 40px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    animation: mhbPopIn .35s ease;
}
@keyframes mhbPopIn {
    from { transform: scale(.9); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}
.mhb-popup-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    transition: color .2s;
}
.mhb-popup-close:hover { color: #fff; }
.mhb-popup-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--mhb-light);
    margin: 0 0 12px;
    line-height: 1.3;
}
.mhb-popup-text {
    font-size: 14px;
    color: rgba(232, 224, 245, .8);
    margin: 0 0 24px;
    line-height: 1.6;
}
.mhb-sub-form { display: flex; flex-direction: column; gap: 12px; }
.mhb-form-row { display: flex; flex-direction: column; }
.mhb-input {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(155, 114, 212, .4);
    border-radius: 8px;
    padding: 11px 14px;
    color: #fff;
    font-size: 14px;
    transition: border .2s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.mhb-input::placeholder { color: rgba(255,255,255,.4); }
.mhb-input:focus { border-color: var(--mhb-purple); box-shadow: 0 0 0 2px rgba(155,114,212,.2); }
.mhb-form-msg {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    display: none;
}
.mhb-form-msg.success { background: rgba(76, 175, 80, .15); color: #81c784; border: 1px solid rgba(76,175,80,.3); }
.mhb-form-msg.error   { background: rgba(244, 67, 54, .15); color: #e57373; border: 1px solid rgba(244,67,54,.3); }
.mhb-popup-btn {
    background: linear-gradient(135deg, var(--mhb-purple), var(--mhb-rose));
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.mhb-popup-btn:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.mhb-popup-btn:disabled { opacity: .6; cursor: not-allowed; }
.mhb-form-privacy { font-size: 11px; color: rgba(255,255,255,.4); text-align: center; margin: 0; }

/* ==========================================================================
   8. Posts relacionados
   ========================================================================== */
.mhb-related-wrap {
    margin: 36px 0;
    padding: 24px;
    background: rgba(155, 114, 212, .04);
    border-radius: var(--mhb-radius);
    border: 1px solid rgba(155, 114, 212, .15);
}
.mhb-related-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--mhb-mid);
    margin: 0 0 18px;
}
.mhb-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.mhb-related-card {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(155, 114, 212, .15);
    transition: transform .25s, box-shadow .25s;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.mhb-related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(155, 114, 212, .2);
}
.mhb-related-img {
    height: 130px;
    background-size: cover;
    background-position: center;
    background-color: #f0ecf9;
}
.mhb-related-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}
.mhb-related-body {
    padding: 12px;
}
.mhb-related-post-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   9. Responsivo general
   ========================================================================== */
@media (max-width: 600px) {
    .mhb-share-buttons { gap: 6px; }
    .mhb-share-btn { font-size: 12px; padding: 8px 12px; }
    .mhb-popup-box { padding: 24px 20px; }
    .mhb-popup-title { font-size: 18px; }
    .mhb-related-grid { grid-template-columns: 1fr 1fr; }
    .mhb-toc { max-width: 100%; }
}

/* ==========================================================================
   10. Share count badges (Jetpack-inspired)
   ========================================================================== */
.mhb-share-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.28);
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-left: 2px;
}
.mhb-share-btn:hover .mhb-share-count {
    background: rgba(255, 255, 255, 0.42);
}
/* Ocultar count en minimal */
.mhb-share-style-minimal .mhb-share-count { display: none; }

/* ==========================================================================
   11. SEO Metabox — preview Google (post-controls)
   ========================================================================== */
.mhb-seo-preview {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 12px 14px;
    margin-top: 10px;
    font-family: Arial, sans-serif;
}
.mhb-seo-preview .preview-url   { color: #218739; font-size: 12px; margin-bottom: 3px; }
.mhb-seo-preview .preview-title { color: #1a0dab; font-size: 17px; text-decoration: underline; cursor: default; margin-bottom: 3px; line-height: 1.3; }
.mhb-seo-preview .preview-desc  { color: #444; font-size: 13px; line-height: 1.5; }
