/**
 * BonusBuilder Frontend Styles
 * BEM naming: .bb-{widget}__{element}--{modifier}
 */

/* ===== RESET & BASE ===== */
.bb-page {
    font-family: var(--bb-font, 'Inter', sans-serif);
    font-size: var(--bb-font-size, 16px);
    line-height: var(--bb-line-height, 1.6);
    color: var(--bb-text, #1f2937);
}

.bb-page *, .bb-page *::before, .bb-page *::after {
    box-sizing: border-box;
}

/* ===== SECTIONS ===== */
.bb-section {
    position: relative;
    overflow: hidden;
}

.bb-section__overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
}

.bb-section__inner {
    position: relative;
    z-index: 1;
    max-width: var(--bb-container, 1200px);
    margin: 0 auto;
    padding: 0 20px;
}

.bb-section--full_width .bb-section__inner {
    max-width: 100%;
    padding: 0;
}

.bb-section--narrow .bb-section__inner {
    max-width: 800px;
}

/* ===== ROW / COLUMNS ===== */
.bb-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.bb-column {
    flex: 1 1 0%;
    min-width: 0;
}

.bb-column--valign-top    { align-self: flex-start; }
.bb-column--valign-middle { align-self: center; }
.bb-column--valign-bottom { align-self: flex-end; }

/* ===== WIDGET SPACING ===== */
.bb-widget {
    margin-bottom: 20px;
}

.bb-widget:last-child {
    margin-bottom: 0;
}

/* ===== HEADING ===== */
.bb-heading {
    margin: 0 0 0.5em;
    line-height: 1.3;
}

h1.bb-heading { font-size: var(--bb-h1, 2.5rem); }
h2.bb-heading { font-size: var(--bb-h2, 2rem); }
h3.bb-heading { font-size: var(--bb-h3, 1.5rem); }
h4.bb-heading { font-size: var(--bb-h4, 1.25rem); }

/* ===== TEXT EDITOR ===== */
.bb-text-editor p { margin: 0 0 1em; }
.bb-text-editor p:last-child { margin-bottom: 0; }
.bb-text-editor a { color: var(--bb-primary); text-decoration: underline; }

/* ===== IMAGE ===== */
.bb-image img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

.bb-image__caption {
    font-size: 0.875em;
    color: var(--bb-text-light);
    margin-top: 8px;
    text-align: center;
}

/* ===== BUTTON ===== */
.bb-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    line-height: 1;
}

.bb-button--small  { padding: 8px 16px;  font-size: 0.875rem; }
.bb-button--medium { padding: 12px 24px; font-size: 1rem; }
.bb-button--large  { padding: 16px 32px; font-size: 1.125rem; }
.bb-button--xl     { padding: 20px 40px; font-size: 1.25rem; }
.bb-button--full   { display: flex; width: 100%; justify-content: center; }

.bb-button--filled {
    background: var(--bb-btn-bg, var(--bb-primary));
    color: var(--bb-btn-color, #ffffff);
    border-color: var(--bb-btn-bg, var(--bb-primary));
    border-radius: 6px;
}

.bb-button--filled:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.bb-button--outline {
    background: transparent;
    color: var(--bb-btn-bg, var(--bb-primary));
    border-color: var(--bb-btn-bg, var(--bb-primary));
    border-radius: 6px;
}

.bb-button--outline:hover {
    background: var(--bb-btn-bg, var(--bb-primary));
    color: #fff;
}

.bb-button--text {
    background: transparent;
    color: var(--bb-btn-bg, var(--bb-primary));
    padding-left: 0;
    padding-right: 0;
}

.bb-button--text:hover { opacity: 0.7; }

.bb-button--gradient {
    background: linear-gradient(135deg, var(--bb-primary), var(--bb-secondary));
    color: var(--bb-btn-color, #ffffff);
    border-radius: 6px;
}

.bb-button--gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ===== SPACER ===== */
.bb-spacer { width: 100%; }

/* ===== DIVIDER ===== */
.bb-divider {
    border: 0;
    border-top-style: solid;
}

/* ===== VIDEO ===== */
.bb-video { border-radius: 8px; overflow: hidden; }

/* ===== ICON ===== */
.bb-icon .dashicons {
    width: auto;
    height: auto;
    display: inline-block;
}

/* ===== IMAGE BOX ===== */
.bb-image-box {
    text-align: center;
}

.bb-image-box--left,
.bb-image-box--right {
    display: flex;
    gap: 20px;
    text-align: left;
}

.bb-image-box--right {
    flex-direction: row-reverse;
}

.bb-image-box__image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.bb-image-box--left .bb-image-box__image,
.bb-image-box--right .bb-image-box__image {
    flex: 0 0 40%;
}

.bb-image-box__title {
    font-size: 1.25rem;
    margin: 12px 0 8px;
    font-weight: 600;
}

.bb-image-box__desc {
    color: var(--bb-text-light);
    margin: 0;
}

.bb-image-box__link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ===== ICON BOX ===== */
.bb-icon-box__icon .dashicons {
    width: auto;
    height: auto;
    color: var(--bb-primary);
}

.bb-icon-box__title {
    font-size: 1.25rem;
    margin: 16px 0 8px;
    font-weight: 600;
}

.bb-icon-box__desc {
    color: var(--bb-text-light);
    margin: 0;
}

/* ===== TESTIMONIAL ===== */
.bb-testimonial--card {
    background: var(--bb-surface);
    border-radius: 12px;
    padding: 32px;
}

.bb-testimonial--bubble {
    background: var(--bb-surface);
    border-radius: 16px;
    padding: 24px;
    position: relative;
}

.bb-testimonial--bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 32px;
    width: 20px;
    height: 20px;
    background: var(--bb-surface);
    transform: rotate(45deg);
}

.bb-testimonial__stars {
    color: #f59e0b;
    font-size: 1.25rem;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.bb-testimonial__quote {
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.6;
    margin: 0 0 20px;
    border: 0;
    padding: 0;
}

.bb-testimonial__author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bb-testimonial__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.bb-testimonial__name {
    display: block;
    font-weight: 600;
}

.bb-testimonial__role {
    display: block;
    font-size: 0.875rem;
    color: var(--bb-text-light);
}

/* ===== COUNTER ===== */
.bb-counter__number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--bb-primary);
}

.bb-counter__title {
    font-size: 1rem;
    color: var(--bb-text-light);
    margin-top: 8px;
}

/* ===== PROGRESS BAR ===== */
.bb-progress { margin-bottom: 16px; }

.bb-progress__header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 500;
}

.bb-progress__pct { color: var(--bb-text-light); }

/* ===== ALERT ===== */
.bb-alert {
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 4px solid;
    position: relative;
}

.bb-alert--info    { background: #eff6ff; border-color: #3b82f6; color: #1e40af; }
.bb-alert--success { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.bb-alert--warning { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.bb-alert--error   { background: #fef2f2; border-color: #ef4444; color: #991b1b; }

.bb-alert__title { margin-right: 4px; }
.bb-alert__close {
    position: absolute;
    top: 12px; right: 12px;
    background: none; border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    line-height: 1;
}

.bb-alert__close:hover { opacity: 1; }

/* ===== ACCORDION ===== */
.bb-accordion__item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.bb-accordion--minimal .bb-accordion__item {
    border: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
}

.bb-accordion--filled .bb-accordion__item {
    border: none;
    background: var(--bb-surface);
    border-radius: 8px;
}

.bb-accordion__trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    color: inherit;
}

.bb-accordion__trigger:hover { background: rgba(0,0,0,0.02); }

.bb-accordion__icon {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.bb-accordion__trigger[aria-expanded="true"] .bb-accordion__icon {
    transform: rotate(45deg);
}

.bb-accordion__panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.bb-accordion__content {
    padding: 0 20px 16px;
    color: var(--bb-text-light);
}

/* ===== TABS ===== */
.bb-tabs__nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}

.bb-tabs--pills .bb-tabs__nav {
    border: none;
    gap: 8px;
}

.bb-tabs--boxed .bb-tabs__nav {
    border: none;
    background: var(--bb-surface);
    border-radius: 8px;
    padding: 4px;
}

.bb-tabs__tab {
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--bb-text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.bb-tabs__tab--active,
.bb-tabs__tab:hover {
    color: var(--bb-primary);
    border-bottom-color: var(--bb-primary);
}

.bb-tabs--pills .bb-tabs__tab {
    border: none;
    border-radius: 20px;
    margin: 0;
}

.bb-tabs--pills .bb-tabs__tab--active {
    background: var(--bb-primary);
    color: #fff;
}

.bb-tabs--boxed .bb-tabs__tab {
    border: none;
    border-radius: 6px;
    margin: 0;
}

.bb-tabs--boxed .bb-tabs__tab--active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: var(--bb-text);
}

.bb-tabs__panel {
    line-height: 1.6;
}

/* ===== PRICING ===== */
.bb-pricing {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bb-pricing:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.bb-pricing--highlighted {
    border-color: var(--bb-primary);
    transform: scale(1.05);
}

.bb-pricing__badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bb-primary);
    color: #fff;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.bb-pricing__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 16px;
}

.bb-pricing__currency {
    font-size: 1.5rem;
    vertical-align: top;
    line-height: 1;
}

.bb-pricing__amount {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
}

.bb-pricing__period {
    font-size: 1rem;
    color: var(--bb-text-light);
}

.bb-pricing__features {
    list-style: none;
    padding: 0;
    margin: 24px 0;
    text-align: left;
}

.bb-pricing__features li {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.bb-pricing__features li:last-child { border: none; }

/* ===== CTA ===== */
.bb-cta {
    padding: 48px 32px;
    border-radius: 16px;
}

.bb-cta__title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 12px;
}

.bb-cta__desc {
    font-size: 1.1rem;
    color: var(--bb-text-light);
    margin: 0 0 24px;
}

/* ===== POSTS GRID ===== */
.bb-posts-grid__item {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.25s ease;
}

.bb-posts-grid__item:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.bb-posts-grid__image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.bb-posts-grid__content {
    padding: 20px;
}

.bb-posts-grid__date {
    font-size: 0.8rem;
    color: var(--bb-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bb-posts-grid__title {
    font-size: 1.1rem;
    margin: 8px 0;
}

.bb-posts-grid__title a {
    text-decoration: none;
    color: inherit;
}

.bb-posts-grid__title a:hover { color: var(--bb-primary); }

.bb-posts-grid__excerpt {
    font-size: 0.9rem;
    color: var(--bb-text-light);
    margin: 0;
}

/* ===== CONTACT FORM ===== */
.bb-form__field {
    margin-bottom: 20px;
}

.bb-form__label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.bb-form__input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: #fff;
}

.bb-form__input:focus {
    outline: none;
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.bb-form__success {
    padding: 16px;
    background: #f0fdf4;
    color: #166534;
    border-radius: 8px;
    margin-top: 16px;
    font-weight: 500;
}

/* ===== MAP ===== */
.bb-map {
    border-radius: 8px;
    overflow: hidden;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .bb-row {
        flex-direction: column;
    }

    .bb-column {
        flex: 1 1 100% !important;
    }

    .bb-section__inner {
        padding: 0 16px;
    }

    .bb-posts-grid {
        grid-template-columns: 1fr !important;
    }

    .bb-image-box--left,
    .bb-image-box--right {
        flex-direction: column;
    }

    .bb-image-box--left .bb-image-box__image,
    .bb-image-box--right .bb-image-box__image {
        flex: 0 0 100%;
    }

    .bb-pricing--highlighted {
        transform: none;
    }

    .bb-counter__number {
        font-size: 2.5rem;
    }
}
