/**
 * Dynamic Sections CSS
 * Styles for all dynamic section types
 * 
 * @package DynamicSections
 * @version 1.0
 * @created January 12, 2026
 */

/* ============================================
   Base Section Styles
   ============================================ */

.dynamic-section {
    margin: 20px 0;
    position: relative;
}

.section-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
}

/* ============================================
   Banner Section
   ============================================ */

/* Single banner (vertical stack) */
.banner-section.vertical-stack,
.banner-section:not(.horizontal-scroll):not(.vertical-stack) {
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.banner-section.vertical-stack img,
.banner-section:not(.horizontal-scroll):not(.vertical-stack) img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.banner-section a:hover img {
    transform: scale(1.05);
}

/* ============================================
   Video Section
   ============================================ */

/* Single video (vertical stack) */
.video-section.vertical-stack,
.video-section:not(.horizontal-scroll):not(.vertical-stack) {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-section.vertical-stack iframe,
.video-section.vertical-stack video,
.video-section:not(.horizontal-scroll):not(.vertical-stack) iframe,
.video-section:not(.horizontal-scroll):not(.vertical-stack) video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-iframe {
    border: none;
}

.video-player {
    background: #000;
}

/* ============================================
   External Link Section
   ============================================ */

.external-link-section {
    text-align: center;
    padding: 20px;
}

.external-link-section .btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.external-link-section .btn-primary {
    background: #007bff;
    color: white;
}

.external-link-section .btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.external-link-section .btn-secondary {
    background: #6c757d;
    color: white;
}

.external-link-section .btn-secondary:hover {
    background: #545b62;
}

.external-link-section .btn-success {
    background: #28a745;
    color: white;
}

.external-link-section .btn-success:hover {
    background: #218838;
}

.external-link-section .btn-danger {
    background: #dc3545;
    color: white;
}

.external-link-section .btn-danger:hover {
    background: #c82333;
}

/* ============================================
   Popup Section
   ============================================ */

.popup-section {
    text-align: center;
}

.popup-trigger {
    padding: 12px 30px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-trigger:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.popup-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.popup-content {
    background-color: #fff;
    margin: auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.popup-close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.popup-close:hover,
.popup-close:focus {
    color: #000;
}

.popup-body {
    margin-top: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   Custom HTML Section
   ============================================ */

.custom-html-section {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Service Listing Section
   ============================================ */

.service-listing-section {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.service-listing-section.grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.service-listing-section.list {
    grid-template-columns: 1fr;
}

.service-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.service-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.service-item h3 {
    padding: 15px 15px 10px;
    margin: 0;
    font-size: 18px;
    color: #333;
}

.service-item p {
    padding: 0 15px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.service-price {
    display: block;
    padding: 10px 15px 15px;
    font-size: 20px;
    font-weight: bold;
    color: #007bff;
}

/* ============================================
   Parent Listing Section
   ============================================ */

.parent-listing-section {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.parent-listing-section.grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.parent-listing-section.list {
    grid-template-columns: 1fr;
}

.parent-listing-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.parent-listing-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.parent-listing-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.parent-listing-item h3 {
    padding: 15px 15px 10px;
    margin: 0;
    font-size: 20px;
    color: #333;
}

.parent-listing-item p {
    padding: 0 15px 15px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   Slider Section
   ============================================ */

.slider-section {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.slider-container {
    position: relative;
    width: 100%;
    padding-bottom: 50%; /* Adjust aspect ratio as needed */
    height: 0;
}

.slide {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: fadeSlide 0.5s ease;
}

.slide.active {
    display: block;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    border-radius: 4px;
    font-size: 16px;
}

.slider-prev,
.slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
    border-radius: 4px;
}

.slider-prev:hover,
.slider-next:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slider-prev {
    left: 10px;
}

.slider-next {
    right: 10px;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   iFrame Section
   ============================================ */

.iframe-section {
    width: 100%;
    margin: 20px 0;
}

/* Legacy single iframe (non-horizontal-scroll) */
.iframe-section:not(.horizontal-scroll) {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.embedded-iframe {
    display: block;
    border: none;
}

/* ============================================
   Code Snippet Section
   ============================================ */

.code-snippet-section {
    margin: 20px 0;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .service-listing-section.grid,
    .parent-listing-section.grid {
        grid-template-columns: 1fr;
    }
    
    .popup-content {
        width: 95%;
        padding: 20px;
    }
    
    .slider-prev,
    .slider-next {
        font-size: 18px;
        padding: 8px 12px;
    }
    
    .slide-caption {
        font-size: 14px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .dynamic-section {
        margin: 15px 0;
    }
    
    .external-link-section .btn,
    .popup-trigger {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .service-image,
    .parent-listing-image {
        height: 180px;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .popup-modal,
    .slider-prev,
    .slider-next,
    .popup-trigger {
        display: none !important;
    }
    
    .dynamic-section {
        page-break-inside: avoid;
    }
}
