/* Template-specific styles with unique attribute names to avoid conflicts */

/* Global table styling - applies to all tables by default */
table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 0.95rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

table th {
    background: #132666;
    color: #ffffff;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border: none;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
    font-weight: 400;
    transition: background-color 0.2s ease;
}

/* Alternating row colors for all tables */
table tbody tr:nth-child(even) {
    background-color: #e3d4ad;
}

table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

table tbody tr:hover {
    background-color: rgba(19, 38, 102, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Global image styling - applies to all images by default */
img {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: inline-block;
    margin: 10px;
    vertical-align: top;
}

img:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

/* Make images clickable for enlargement */
img[data-enlarge="true"] {
    cursor: pointer;
    position: relative;
    z-index: 1;
    display: block;
}

/* Container for clickable images with overlay */
.image-enlarge-container {
    position: relative !important;
    display: inline-block !important;
    margin: 10px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

/* Specific styling for carousel containers */
.image-enlarge-container .carousel {
    width: 800px !important;
    height: 500px !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    text-align: center !important;
    display: block !important;
}

/* Responsive carousel sizing */
@media (max-width: 768px) {
    .carousel,
    .image-enlarge-container .carousel {
        width: 100% !important;
        height: 400px !important;
        max-width: 100% !important;
    }
    
    .carousel-control-prev {
        left: 10px;
    }
    
    .carousel-control-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .carousel,
    .image-enlarge-container .carousel {
        width: 100% !important;
        height: 300px !important;
        max-width: 100% !important;
    }
    
    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 40px;
    }
    
    .carousel-control-prev {
        left: 5px;
    }
    
    .carousel-control-next {
        right: 5px;
    }
    
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 16px;
        height: 16px;
        background-size: 16px 16px;
    }
}

.image-enlarge-container:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* More specific selector to ensure it works */
.template-container .image-enlarge-container {
    position: relative !important;
    display: inline-block !important;
}

.image-enlarge-container::after {
    content: "🔍 Click to enlarge" !important;
    position: absolute !important;
    bottom: 8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(19, 38, 102, 0.95) !important;
    color: white !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    pointer-events: none !important;
    z-index: 9999 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    white-space: nowrap !important;
}

.template-container .image-enlarge-container::after {
    content: "🔍 Click to enlarge" !important;
    position: absolute !important;
    bottom: 8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(19, 38, 102, 0.95) !important;
    color: white !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    pointer-events: none !important;
    z-index: 9999 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    white-space: nowrap !important;
}

.image-enlarge-container:hover::after,
.template-container .image-enlarge-container:hover::after {
    opacity: 1 !important;
}

/* Main container styling */
.template-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Image container styling to prevent overflow */
.image-container {
    max-width: 100%;
    overflow: hidden;
    margin: 20px 0;
}

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

/* Image group styling for side-by-side images */
.image-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
    align-items: flex-start;
}

.image-group .image-enlarge-container {
    flex: 1;
    min-width: 200px;
    max-width: calc(50% - 10px);
    margin: 0;
}

.image-group .image-enlarge-container img {
    width: 100%;
    height: auto;
    margin: 0;
}

/* Responsive image group */
@media (max-width: 768px) {
    .image-group {
        flex-direction: column;
    }
    
    .image-group .image-enlarge-container {
        max-width: 100%;
        min-width: auto;
    }
}

/* Section styling */
.template-section {
    margin-bottom: 40px;
    padding: 30px;
    background: transparent;
    border-radius: 12px;
    box-shadow: none;
    border: none;
}

.template-heading {
    color: #ffffff;
    font-size: 2.2rem;
    font-weight: 700;
    margin: 40px 0 20px 0;
    border-bottom: 3px solid #ea3231;
    padding-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.template-heading::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 50px;
    height: 3px;
    background: #ea3231;
}

/* H3 styling for subsections */
.template-section h3 {
    color: #e3d4ad;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 30px 0 15px 0;
    border-left: 4px solid #ea3231;
    padding-left: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* H4 styling for sub-subsections */
.template-section h4 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 500;
    margin: 25px 0 10px 0;
    border-left: 3px solid #ea3231;
    padding-left: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.template-description {
    color: #e3d4ad;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* Paragraph styling */
.template-section p {
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.7;
    margin: 15px 0;
    text-align: justify;
}

/* List styling */
.template-section ul, .template-section ol {
    color: #ffffff;
    margin: 15px 0;
    padding-left: 25px;
}

.template-section li {
    margin: 8px 0;
    line-height: 1.6;
}

/* Strong text styling */
.template-section strong {
    color: #e3d4ad;
    font-weight: 600;
}

/* Horizontal rule styling */
.template-section hr {
    border: none;
    height: 2px;
    background: #ea3231;
    margin: 40px 0;
    border-radius: 1px;
}

/* Add section dividers */
.template-section::after {
    content: '';
    display: block;
    height: 1px;
    background: rgba(227, 212, 173, 0.3);
    margin: 30px 0;
}

/* Remove the last divider */
.template-section:last-child::after {
    display: none;
}

/* Template-specific table wrapper for overflow handling */
.template-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}


/* Features section */
.template-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.template-feature-item {
    background: #132666;
    color: #ffffff;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.template-feature-item:hover {
    transform: translateY(-3px);
}

.template-feature-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.template-feature-text {
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0.9;
}

/* Modal styling for image enlargement */
.template-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.template-modal-content {
    position: relative;
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
}

.template-modal-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.template-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: color 0.3s ease;
}

.template-modal-close:hover {
    color: #ea3231;
}

.template-modal-controls {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

.template-zoom-btn {
    background: #ea3231;
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.template-zoom-btn:hover {
    background: #a62030;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.template-zoom-btn:active {
    transform: translateY(0);
}

/* Responsive design */
@media (max-width: 768px) {
    .template-container {
        padding: 10px;
    }
    
    .template-section {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .template-heading {
        font-size: 1.6rem;
    }
    
    .template-images-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .template-features {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .template-modal-content {
        width: 95%;
    }
    
    .template-modal-controls {
        bottom: -80px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .template-zoom-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .template-table {
        font-size: 0.85rem;
    }
    
    .template-th,
    .template-td {
        padding: 8px 6px;
    }
    
    .template-image {
        height: 150px;
    }
}

/* Sleek Carousel Animations */
.carousel {
    overflow: hidden !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
    height: 500px !important; /* Fixed height to prevent jumping */
    width: 800px !important; /* Fixed width to prevent jumping */
    max-width: 100% !important; /* Responsive constraint */
    margin: 0 auto !important; /* Center the carousel */
    text-align: center !important;
    display: block !important;
}

.carousel:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.carousel-inner {
    height: 100%;
    transition: transform 0.5s ease-in-out; /* Smooth slide transition */
}

.carousel-item {
    height: 100%;
}

.carousel-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Ensure all images fill the same space */
    object-position: center !important; /* Center the image within the container */
    border-radius: 8px !important;
    transition: transform 0.3s ease !important;
    flex: 1 !important; /* Flex fill behavior */
    display: block !important; /* Ensure proper display */
    margin: 0 auto !important;
}

.carousel-item:hover img {
    transform: scale(1.02);
}

.carousel-control-prev,
.carousel-control-next {
    width: 50px;
    height: 50px;
    background: rgba(19, 38, 102, 0.8);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    opacity: 0.7;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: rgba(19, 38, 102, 1);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.carousel-control-prev {
    left: 15px;
}

.carousel-control-next {
    right: 15px;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 20px;
    height: 20px;
    background-size: 20px 20px;
    filter: brightness(0) invert(1);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.carousel-indicators {
    bottom: 20px;
    margin-bottom: 0;
}

.carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(19, 38, 102, 0.8);
    transition: all 0.3s ease;
    margin: 0 5px;
}

.carousel-indicators .active {
    background: #132666;
    border-color: #132666;
    transform: scale(1.2);
}

.carousel-indicators [data-bs-target]:hover {
    background: rgba(19, 38, 102, 0.8);
    transform: scale(1.1);
}

/* Override Bootstrap's default carousel transitions for smoother animations */
.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
    display: block;
}

.carousel-item-next:not(.carousel-item-start),
.active.carousel-item-end {
    transform: translateX(100%);
}

.carousel-item-prev:not(.carousel-item-end),
.active.carousel-item-start {
    transform: translateX(-100%);
}

/* Smooth fade transition for carousel items */
.carousel-fade .carousel-item {
    opacity: 0;
    transition-property: opacity;
    transform: none;
}

.carousel-fade .carousel-item.active,
.carousel-fade .carousel-item-next.carousel-item-start,
.carousel-fade .carousel-item-prev.carousel-item-end {
    z-index: 1;
    opacity: 1;
}

.carousel-fade .active.carousel-item-start,
.carousel-fade .active.carousel-item-end {
    z-index: 0;
    opacity: 0;
    transition: opacity 0s 0.6s;
}

/* Enhanced carousel controls with better visibility */
.carousel-control-prev,
.carousel-control-next {
    background: linear-gradient(135deg, rgba(19, 38, 102, 0.9), rgba(19, 38, 102, 0.7));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: linear-gradient(135deg, rgba(19, 38, 102, 1), rgba(19, 38, 102, 0.9));
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 20px rgba(19, 38, 102, 0.4);
}

/* Code styling */
code {
    background-color: rgba(227, 212, 173, 0.2);
    color: #132666;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    border: 1px solid rgba(19, 38, 102, 0.3);
}

pre {
    background-color: #e3d4ad;
    color: #132666;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    border-left: 4px solid #ea3231;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    font-weight: 500;
}

pre code {
    background-color: transparent;
    color: #132666;
    padding: 0;
    border: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-weight: 500;
}
