/**
 * Pebbles Manager — Frontend Styles
 * Tema: sfondo scuro, card bianche, accenti magenta/viola
 *
 * @package PebblesManager
 * @version 1.0.0
 */

/* ── Icona Pebble ──────────────────────────────────────────────────────── */

.pbm-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 3px;
}

/* ── Box informativo costi (nel form) ──────────────────────────────────── */

.pbm-cost-info {
    margin: 16px 0 8px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.pbm-cost-free {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(22, 101, 52, 0.15));
    border-color: rgba(74, 222, 128, 0.4);
    color: #4ade80;
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.15);
}

.pbm-cost-ok {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(192, 38, 211, 0.12));
    border-color: rgba(192, 38, 211, 0.4);
    color: #e2d9f3;
    box-shadow: 0 0 12px rgba(192, 38, 211, 0.15);
}

.pbm-cost-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(153, 27, 27, 0.15));
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
    animation: pbm-pulse-error 1.5s ease-in-out infinite;
}

@keyframes pbm-pulse-error {
    0%, 100% {
        box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
        border-color: rgba(239, 68, 68, 0.5);
    }
    50% {
        box-shadow: 0 0 24px rgba(239, 68, 68, 0.4), 0 0 48px rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.8);
    }
}

/* ── Checkbox evidenza ─────────────────────────────────────────────────── */

.pbm-featured-options {
    margin: 20px 0 16px;
    padding: 22px 24px;
    background: linear-gradient(145deg, rgba(88, 28, 135, 0.4), rgba(30, 15, 60, 0.7));
    border: 1px solid rgba(217, 70, 239, 0.4);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow:
        0 0 15px rgba(217, 70, 239, 0.15),
        0 0 40px rgba(124, 58, 237, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

/* Glow bar in alto */
.pbm-featured-options::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d946ef, #7c3aed, #d946ef, transparent);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.6);
}

/* Titoletto "⭐ Metti in evidenza" */
.pbm-featured-options::after {
    content: '⭐ Metti in evidenza';
    position: absolute;
    top: 10px;
    right: 16px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    padding: 2px 10px;
    border-radius: 20px;
}

.pbm-featured-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #f0e6ff;
    user-select: none;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(217, 70, 239, 0.2);
    background: rgba(124, 58, 237, 0.08);
    transition: all 0.25s ease;
}

.pbm-featured-label:hover {
    background: rgba(217, 70, 239, 0.15);
    border-color: rgba(217, 70, 239, 0.45);
    box-shadow: 0 0 12px rgba(217, 70, 239, 0.15);
}

.pbm-featured-cb {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #d946ef;
}

.pbm-featured-cb:checked + span,
.pbm-featured-label:has(.pbm-featured-cb:checked) {
    color: #e879f9;
    border-color: rgba(217, 70, 239, 0.6);
    background: rgba(217, 70, 239, 0.18);
    box-shadow: 0 0 16px rgba(217, 70, 239, 0.2);
}

.pbm-featured-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    padding-left: 42px;
    margin-top: -4px;
    line-height: 1.4;
}

/* ── Widget crediti utente (shortcode [pbm_user_credits]) ──────────────── */

.pbm-user-credits-widget {
    padding: 24px;
    background: #fff;
    border: 2px solid #e9d5ff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(88, 28, 135, 0.1);
    max-width: 380px;
}

.pbm-info-text {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 16px;
    line-height: 1.6;
}

.pbm-info-text a {
    color: #c026d3;
    text-decoration: none;
    font-weight: 600;
}

.pbm-info-text a:hover {
    text-decoration: underline;
}

.pbm-credits-balance {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.pbm-credits-label {
    font-size: 14px;
    color: #6b7280;
}

.pbm-credits-value {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #c026d3, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pbm-credits-currency {
    font-size: 14px;
    font-weight: 600;
    color: #c026d3;
}

.pbm-bonus-status {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #faf5ff;
    border: 1px solid #f3e8ff;
}

.pbm-bonus-available {
    color: #16a34a;
}

.pbm-bonus-unavailable {
    color: #6b7280;
}

/* ── Badge saldo ───────────────────────────────────────────────────────── */

.pbm-credit-badge,
.pbm-format-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 16px;
    background: linear-gradient(135deg, #c026d3, #a21caf);
    color: #fff;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(192, 38, 211, 0.3);
}

/* ── Pulsante acquisto Pebbles ─────────────────────────────────────────── */

.pbm-buy-button-wrap {
    margin-top: 4px;
}

.pbm-buy-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #c026d3, #a21caf);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(192, 38, 211, 0.3);
}

.pbm-buy-button:hover,
.pbm-buy-button:focus {
    background: linear-gradient(135deg, #d946ef, #c026d3);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(192, 38, 211, 0.4);
}

/* ── Prezzo in Pebbles (catalogo e prodotto) ───────────────────────────── */

.pbm-price {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: #c026d3;
    font-size: 1.1em;
}

/* ── Banner prodotto ───────────────────────────────────────────────────── */

.pbm-product-notice {
    margin: 16px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #faf5ff, #fdf4ff);
    border: 2px solid #e9d5ff;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    color: #581c87;
}

.pbm-product-notice p {
    margin: 0 0 6px;
}

.pbm-product-notice p:last-child {
    margin-bottom: 0;
}

.pbm-product-notice a {
    color: #c026d3;
    font-weight: 600;
    text-decoration: none;
}

.pbm-product-notice a:hover {
    text-decoration: underline;
}

/* ── Checkout info ─────────────────────────────────────────────────────── */

.pbm-checkout-info {
    margin: 10px 0;
    padding: 14px 18px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    font-size: 14px;
}

.pbm-checkout-balance {
    margin: 0 0 6px;
    color: #374151;
}

.pbm-checkout-warning {
    margin: 0;
    color: #dc2626;
}

.pbm-checkout-warning a {
    color: #c026d3;
    font-weight: 600;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .pbm-cost-info {
        font-size: 14px;
        padding: 12px 14px;
    }

    .pbm-user-credits-widget {
        max-width: 100%;
    }

    .pbm-credits-value {
        font-size: 28px;
    }

    .pbm-buy-button {
        width: 100%;
        justify-content: center;
    }
}


/* ── UM Profile: Tab Pebbles ───────────────────────────────────────────── */

.pbm-um-pebbles-tab {
    padding: 20px 0;
}

.pbm-um-pebbles-tab .pbm-user-credits-widget {
    max-width: 100%;
}

/* ── UM Profile: Tab Posts — Tabella articoli ──────────────────────────── */

.pbm-um-posts-tab {
    padding: 10px 0;
}

.pbm-um-no-posts {
    text-align: center;
    color: #9ca3af;
    font-size: 15px;
    padding: 40px 0;
}

.pbm-um-posts-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.pbm-um-posts-table thead th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e9d5ff;
    background: #faf5ff;
}

.pbm-um-posts-table tbody tr {
    transition: background 0.15s ease;
}

.pbm-um-posts-table tbody tr:hover {
    background: #faf5ff;
}

.pbm-um-posts-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3e8ff;
    vertical-align: middle;
    color: #374151;
}

.pbm-um-posts-table .pbm-col-title a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 500;
}

.pbm-um-posts-table .pbm-col-title a:hover {
    color: #c026d3;
    text-decoration: underline;
}

/* ── Status badges ─────────────────────────────────────────────────────── */

.pbm-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.pbm-status-publish {
    background: #dcfce7;
    color: #166534;
}

.pbm-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.pbm-status-draft {
    background: #f3f4f6;
    color: #6b7280;
}

/* ── Pulsante elimina ──────────────────────────────────────────────────── */

.pbm-delete-post-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff;
    color: #ef4444;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pbm-delete-post-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #dc2626;
}

.pbm-delete-post-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── UM Pebbles tab icon override ──────────────────────────────────────── */

.um-profile-nav-pebbles a i.um-faicon-diamond {
    font-size: 0 !important;
    display: inline-block;
    width: 20px;
    height: 20px;
    background: url('../img/pebble-icon.png') no-repeat center center;
    background-size: contain;
    vertical-align: middle;
}

.um-profile-nav-pebbles a i.um-faicon-diamond::before {
    display: none;
}

/* ── Responsive posts table ────────────────────────────────────────────── */

@media (max-width: 600px) {
    .pbm-um-posts-table thead {
        display: none;
    }

    .pbm-um-posts-table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #e9d5ff;
        border-radius: 12px;
        padding: 12px;
        background: #fff;
    }

    .pbm-um-posts-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border-bottom: none;
    }

    .pbm-um-posts-table tbody td::before {
        font-weight: 600;
        color: #6b7280;
        font-size: 12px;
        text-transform: uppercase;
    }

    .pbm-um-posts-table .pbm-col-title::before { content: 'Titolo'; }
    .pbm-um-posts-table .pbm-col-status::before { content: 'Stato'; }
    .pbm-um-posts-table .pbm-col-date::before { content: 'Data'; }
    .pbm-um-posts-table .pbm-col-cat::before { content: 'Categoria'; }
    .pbm-um-posts-table .pbm-col-actions::before { content: ''; }
}


/* ── Header Pebbles Badge ──────────────────────────────────────────────── */

#site-header .pbm-header-item {
    display: flex !important;
    align-items: center !important;
    margin-top: 11px;
}

#site-header .pbm-header-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 12px !important;
    text-decoration: none !important;
    color: #fff !important;
    transition: all 0.3s ease;
    border-radius: 16px !important;
    border: 1px solid rgba(217, 70, 239, 0.6) !important;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(192, 38, 211, 0.25)) !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    box-shadow: 0 0 12px rgba(217, 70, 239, 0.3), 0 0 4px rgba(124, 58, 237, 0.2) !important;
}

#site-header .pbm-header-badge:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(192, 38, 211, 0.4)) !important;
    border-color: rgba(217, 70, 239, 0.9) !important;
    color: #fff !important;
    box-shadow: 0 0 20px rgba(217, 70, 239, 0.5), 0 0 8px rgba(124, 58, 237, 0.3) !important;
}

#site-header .pbm-header-top {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
}

#site-header .pbm-header-icon {
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
    vertical-align: middle !important;
}

#site-header .pbm-header-amount {
    color: #e879f9 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
}

#site-header .pbm-header-buy {
    font-size: 9px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    color: #fff !important;
    font-weight: 600 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
    padding-left: 8px !important;
    transition: color 0.25s ease;
}

#site-header .pbm-header-badge:hover .pbm-header-buy {
    color: #d946ef !important;
}

@media (max-width: 959px) {
    #site-header .pbm-header-buy {
        display: none !important;
    }
    #site-header .pbm-header-badge {
        padding: 3px 8px !important;
    }
}
