/**
 * Page Builder - Frontend Widget Styles
 * Styles for rendered page builder content on the frontend
 */

/* ============================================
   BASE PAGE BUILDER CONTENT
   ============================================ */

.pb-page-content {
    overflow-x: hidden;
}

/* ============================================
   SECTIONS
   ============================================ */

.pb-section {
    position: relative;
    width: 100%;
}

.pb-section-inner {
    position: relative;
    z-index: 1;
}

/* Full width section */
.pb-section[data-width="full"] .pb-section-inner {
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Boxed section */
.pb-section[data-width="boxed"] .pb-section-inner {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Section overlay */
.pb-section-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ============================================
   COLUMNS
   ============================================ */

.pb-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.pb-column {
    min-height: 50px;
    position: relative;
}

/* Column width classes */
.pb-col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.pb-col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.pb-col-3 { flex: 0 0 25%; max-width: 25%; }
.pb-col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.pb-col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.pb-col-6 { flex: 0 0 50%; max-width: 50%; }
.pb-col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.pb-col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.pb-col-9 { flex: 0 0 75%; max-width: 75%; }
.pb-col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.pb-col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.pb-col-12 { flex: 0 0 100%; max-width: 100%; }

/* Account for gaps in column widths */
.pb-columns[style*="gap"] .pb-col-6 {
    flex: 0 0 calc(50% - 0.5rem);
    max-width: calc(50% - 0.5rem);
}

.pb-columns[style*="gap"] .pb-col-4 {
    flex: 0 0 calc(33.333333% - 0.666rem);
    max-width: calc(33.333333% - 0.666rem);
}

.pb-columns[style*="gap"] .pb-col-3 {
    flex: 0 0 calc(25% - 0.75rem);
    max-width: calc(25% - 0.75rem);
}

/* ============================================
   WIDGETS BASE
   ============================================ */

.pb-widget {
    position: relative;
}

/* ============================================
   HEADING WIDGET
   ============================================ */

.pb-widget-heading h1,
.pb-widget-heading h2,
.pb-widget-heading h3,
.pb-widget-heading h4,
.pb-widget-heading h5,
.pb-widget-heading h6 {
    margin: 0;
    line-height: 1.3;
}

.pb-widget-heading h1 { font-size: 2.5rem; }
.pb-widget-heading h2 { font-size: 2rem; }
.pb-widget-heading h3 { font-size: 1.75rem; }
.pb-widget-heading h4 { font-size: 1.5rem; }
.pb-widget-heading h5 { font-size: 1.25rem; }
.pb-widget-heading h6 { font-size: 1rem; }

/* ============================================
   TEXT WIDGET
   ============================================ */

.pb-widget-text {
    line-height: 1.7;
}

.pb-widget-text p {
    margin-bottom: 1em;
}

.pb-widget-text p:last-child {
    margin-bottom: 0;
}

.pb-widget-text ul,
.pb-widget-text ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.pb-widget-text a {
    color: #2563eb;
    text-decoration: underline;
}

.pb-widget-text a:hover {
    color: #1d4ed8;
}

/* ============================================
   IMAGE WIDGET
   ============================================ */

.pb-widget-image {
    line-height: 0;
}

.pb-widget-image img {
    max-width: 100%;
    height: auto;
}

.pb-widget-image[data-align="center"] {
    text-align: center;
}

.pb-widget-image[data-align="right"] {
    text-align: right;
}

.pb-widget-image figcaption {
    line-height: 1.4;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* ============================================
   BUTTON WIDGET
   ============================================ */

.pb-widget-button {
    display: inline-block;
}

.pb-widget-button a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pb-widget-button a:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pb-widget-button a:active {
    transform: translateY(0);
}

/* ============================================
   VIDEO WIDGET
   ============================================ */

.pb-widget-video {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.pb-widget-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============================================
   SPACER WIDGET
   ============================================ */

.pb-widget-spacer {
    display: block;
}

/* ============================================
   DIVIDER WIDGET
   ============================================ */

.pb-widget-divider {
    display: flex;
    align-items: center;
}

.pb-widget-divider hr {
    flex: 1;
    border: none;
    border-top-style: solid;
    margin: 0;
}

/* ============================================
   PRODUCT GRID WIDGET
   ============================================ */

.pb-widget-products {
    display: grid;
    gap: 1.5rem;
}

.pb-widget-products[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.pb-widget-products[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.pb-widget-products[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.pb-product-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.pb-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.pb-product-image {
    position: relative;
    padding-bottom: 100%;
    overflow: hidden;
    background: #f3f4f6;
}

.pb-product-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pb-product-card:hover .pb-product-image img {
    transform: scale(1.05);
}

.pb-product-info {
    padding: 1rem;
}

.pb-product-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pb-product-price {
    font-weight: 700;
    color: #16a34a;
}

.pb-product-original-price {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* ============================================
   CATEGORY GRID WIDGET
   ============================================ */

.pb-widget-categories {
    display: grid;
    gap: 1.5rem;
}

.pb-widget-categories[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.pb-widget-categories[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.pb-widget-categories[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr);
}

.pb-category-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.2s ease;
}

.pb-category-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.pb-category-image {
    position: relative;
    padding-bottom: 75%;
    overflow: hidden;
    background: #f3f4f6;
}

.pb-category-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pb-category-card:hover .pb-category-image img {
    transform: scale(1.05);
}

.pb-category-name {
    padding: 1rem;
    font-weight: 600;
    color: #1f2937;
}

/* ============================================
   TESTIMONIAL WIDGET
   ============================================ */

.pb-widget-testimonials {
    display: grid;
    gap: 1.5rem;
}

.pb-widget-testimonials[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.pb-widget-testimonials[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.pb-testimonial-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pb-testimonial-quote {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    font-style: italic;
    color: #374151;
    line-height: 1.6;
}

.pb-testimonial-quote::before {
    content: '"';
    position: absolute;
    left: 0;
    top: -0.25rem;
    font-size: 2rem;
    color: #d1d5db;
    font-family: Georgia, serif;
}

.pb-testimonial-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pb-testimonial-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    background: #f3f4f6;
}

.pb-testimonial-avatar-placeholder {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
}

.pb-testimonial-name {
    font-weight: 600;
    color: #1f2937;
}

.pb-testimonial-title {
    font-size: 0.875rem;
    color: #6b7280;
}

.pb-testimonial-rating {
    display: flex;
    gap: 0.125rem;
    margin-bottom: 0.75rem;
}

.pb-testimonial-star {
    width: 1rem;
    height: 1rem;
    fill: #fbbf24;
}

/* ============================================
   FAQ ACCORDION WIDGET
   ============================================ */

.pb-widget-faq {
    border-radius: 0.5rem;
    overflow: hidden;
}

.pb-faq-item {
    border-bottom: 1px solid #e5e7eb;
}

.pb-faq-item:last-child {
    border-bottom: none;
}

.pb-faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: white;
    border: none;
    text-align: left;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pb-faq-question:hover {
    background: #f9fafb;
}

.pb-faq-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #6b7280;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.pb-faq-item.active .pb-faq-icon {
    transform: rotate(180deg);
}

.pb-faq-answer {
    max-height: 0;
    overflow: hidden;
    background: #f9fafb;
    transition: max-height 0.3s ease;
}

.pb-faq-item.active .pb-faq-answer {
    max-height: 500px;
}

.pb-faq-answer-inner {
    padding: 1rem 1.25rem;
    color: #4b5563;
    line-height: 1.6;
}

/* ============================================
   BANNER WIDGET
   ============================================ */

.pb-widget-banner {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
}

.pb-banner-image {
    width: 100%;
    height: auto;
    display: block;
}

.pb-banner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.pb-banner-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pb-banner-subtitle {
    font-size: 1.125rem;
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.pb-banner-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: white;
    color: #1f2937;
    border-radius: 0.375rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pb-banner-button:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

/* ============================================
   HTML WIDGET
   ============================================ */

.pb-widget-html {
    overflow: hidden;
}

/* ============================================
   SHORTCODE WIDGET
   ============================================ */

.pb-widget-shortcode {
    position: relative;
}

/* ============================================
   RESPONSIVE VISIBILITY
   ============================================ */

/* Hide on Desktop */
@media (min-width: 1024px) {
    .pb-hide-desktop {
        display: none !important;
    }
}

/* Hide on Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .pb-hide-tablet {
        display: none !important;
    }
}

/* Hide on Mobile */
@media (max-width: 767px) {
    .pb-hide-mobile {
        display: none !important;
    }
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet */
@media (max-width: 1023px) {
    .pb-columns {
        flex-wrap: wrap;
    }
    
    .pb-col-1, .pb-col-2, .pb-col-3, .pb-col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .pb-col-5, .pb-col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .pb-col-7, .pb-col-8, .pb-col-9, .pb-col-10, .pb-col-11 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .pb-widget-heading h1 { font-size: 2rem; }
    .pb-widget-heading h2 { font-size: 1.75rem; }
    .pb-widget-heading h3 { font-size: 1.5rem; }
    
    .pb-widget-products[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pb-widget-categories[data-columns="6"] {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .pb-widget-testimonials[data-columns="3"] {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pb-banner-title {
        font-size: 1.5rem;
    }
    
    .pb-banner-subtitle {
        font-size: 1rem;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .pb-section[data-width="boxed"] .pb-section-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .pb-columns {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .pb-col-1, .pb-col-2, .pb-col-3, .pb-col-4,
    .pb-col-5, .pb-col-6, .pb-col-7, .pb-col-8,
    .pb-col-9, .pb-col-10, .pb-col-11, .pb-col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .pb-widget-heading h1 { font-size: 1.75rem; }
    .pb-widget-heading h2 { font-size: 1.5rem; }
    .pb-widget-heading h3 { font-size: 1.25rem; }
    .pb-widget-heading h4 { font-size: 1.125rem; }
    
    .pb-widget-products[data-columns="2"],
    .pb-widget-products[data-columns="3"],
    .pb-widget-products[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .pb-widget-categories[data-columns="3"],
    .pb-widget-categories[data-columns="4"],
    .pb-widget-categories[data-columns="6"] {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .pb-widget-testimonials[data-columns="2"],
    .pb-widget-testimonials[data-columns="3"] {
        grid-template-columns: 1fr;
    }
    
    .pb-banner-overlay {
        padding: 1rem;
    }
    
    .pb-banner-title {
        font-size: 1.25rem;
    }
    
    .pb-banner-subtitle {
        font-size: 0.875rem;
    }
    
    .pb-banner-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .pb-faq-question {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }
    
    .pb-faq-answer-inner {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes pb-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pb-animate-fade-in {
    animation: pb-fade-in 0.5s ease-out;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .pb-widget-video {
        display: none;
    }
    
    .pb-section {
        break-inside: avoid;
    }
    
    .pb-hide-desktop,
    .pb-hide-tablet,
    .pb-hide-mobile {
        display: block !important;
    }
}
