/*
 * BespokeCMS Core Styles
 * These styles are required for proper CMS functionality and must be included in all themes.
 * Include via: @await Html.PartialAsync("_CmsStyles") in your layout's <head>
 */

/* ============================================
 * Responsive Images - Prevent overflow in all content areas
 * ============================================ */

/* CMS Content Areas - ensure all images are responsive */
.content img,
.content-section img,
.secondary-content img,
.cms-layout img,
.cms-content img,
[data-content-area] img,
main img,
article img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Global fallback - constrain any image that might overflow its container */
/* Exclude navbar and branded images from auto-height */
img:not(.navbar-brand img):not([height]) {
    max-width: 100%;
    height: auto;
}

/* Prevent inline images from breaking layout - content areas only */
.content-section img,
.cms-content img,
main p img,
main div img {
    max-width: 100%;
    height: auto;
}

/* ============================================
 * Section Spacing Override
 * ============================================ */

.rainbow-section-gap {
    padding: 75px 0 !important;
}

/* ============================================
 * CMS Layout Components
 * ============================================ */

/* CMS Layout - Bootstrap grid support for content */
.cms-layout {
    margin: 20px 0;
}

.cms-layout .card {
    margin-bottom: 1rem;
}

/* Ensure content containers don't overflow */
.content,
.secondary-content,
.cms-content {
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
 * Form Styles - Required for CMS forms to work properly
 * ============================================ */

/* CMS Form base styling (can be overridden by themes) */
.cms-form {
    max-width: 100%;
}

.cms-form .form-group {
    margin-bottom: 20px;
}

.cms-form .field-validation-error {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 0.25rem;
}

.cms-form .validation-summary-errors {
    color: #dc3545;
    margin-bottom: 1rem;
}

.cms-form .validation-summary-errors ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

/* Doob theme form styling */
.cms-form.rainbow-contact-form .form-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    display: block;
    color: var(--color-body, #999999);
}

.cms-form.rainbow-contact-form .form-control {
    background: transparent;
    border: 2px solid var(--color-border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    padding: 15px 20px;
    font-size: 16px;
    color: var(--color-body, #999999);
    transition: all 0.3s ease;
}

.cms-form.rainbow-contact-form .form-control:focus {
    border-color: var(--color-primary, #059DFF);
    box-shadow: none;
    outline: none;
    background: transparent;
}

.cms-form.rainbow-contact-form .form-control::placeholder {
    color: var(--color-body, #999999);
    opacity: 0.6;
}

.cms-form.rainbow-contact-form textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

.cms-form.rainbow-contact-form .form-select {
    background: transparent;
    border: 2px solid var(--color-border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    padding: 15px 20px;
    font-size: 16px;
    color: var(--color-body, #999999);
}

/* Light mode form adjustments */
body.active-light-mode .cms-form.rainbow-contact-form .form-control {
    border-color: #e9e9e9;
    color: #1a1a1a;
}

body.active-light-mode .cms-form.rainbow-contact-form .form-control::placeholder {
    color: #666666;
}

body.active-light-mode .cms-form.rainbow-contact-form .form-label {
    color: #1a1a1a;
}

/* Form submit button - matches Doob btn-default */
.cms-form .btn-default.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 35px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(95deg, var(--color-primary, #059DFF) 15%, var(--color-tertiary, #780206) 45%, var(--color-pink, #f81f9f) 75%, var(--color-secondary, #FB5343) 100%) 95%/200% 100%;
    color: #ffffff;
}

.cms-form .btn-default.btn-submit:hover {
    background-position: 0% 100%;
    transform: translateY(-3px);
}

.cms-form .btn-default.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner animation */
.cms-form .btn-spinner .spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
 * Accessibility - Skip links and focus states
 * ============================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* ============================================
 * Hero/Slider Text Contrast
 * Ensures text is readable over background images
 * Only targets slider areas WITH background overlays (data-black-overlay attribute)
 * ============================================ */

/* Hero/Slider - darker overlay for better text contrast */
.slider-area[data-black-overlay]::before,
.slider-style-5[data-black-overlay]::before {
    background: linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0.2) 100%) !important;
    opacity: 1 !important;
}

/* Only apply white text to slider areas with background images (indicated by data-black-overlay) */
.slider-area[data-black-overlay] .inner {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Remove text-shadow from gradient text - shadows don't work well with transparent text fill */
.slider-area[data-black-overlay] .inner .theme-gradient,
.slider-area[data-black-overlay] .inner .rainbow-sub-badge,
.slider-area[data-black-overlay] .inner .rainbow-sub-badge span {
    text-shadow: none !important;
}

/* Hero/Slider subtitle - override light mode text color to ensure visibility */
/* Only for sliders with background overlay */
body.active-light-mode .slider-style-5[data-black-overlay] .inner .subtitle,
body.active-light-mode .slider-area[data-black-overlay] .inner .subtitle,
body.active-light-mode .slider-area[data-black-overlay] .inner .title,
.slider-area[data-black-overlay] .inner .subtitle,
.slider-style-5[data-black-overlay] .inner .subtitle {
    color: var(--color-white, #ffffff) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Ensure the decorative line after subtitle is visible */
body.active-light-mode .slider-style-5[data-black-overlay] .inner .subtitle::after,
.slider-style-5[data-black-overlay] .inner .subtitle::after {
    background: var(--color-primary, var(--color-pink, #f81f9f)) !important;
}

/* Hero/Slider description text - only for areas with background images */
.slider-area[data-black-overlay] .description,
.slider-area[data-black-overlay] p:not(.btn):not(button):not(.subtitle) {
    color: rgba(255, 255, 255, 0.85) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Hero/Slider headings - only for areas with background images */
.slider-area[data-black-overlay] h1,
.slider-area[data-black-overlay] h2,
.slider-area[data-black-overlay] .title,
.slider-area[data-black-overlay] .inner h1,
.slider-area[data-black-overlay] .inner h2 {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Utility class for subtitle with colored bar - can be added to any element */
.cms-subtitle-bar {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding-left: 20px;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    margin-bottom: 15px;
}

.cms-subtitle-bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 100%;
    min-height: 20px;
    background: var(--color-primary, #059DFF);
    border-radius: 2px;
}

/* ============================================
 * Blog Card Alignment
 * Ensures blog cards in grid have consistent heights
 * ============================================ */

/* Blog cards in row should have equal heights */
.blog-area .row.row--15 {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.blog-area .row.row--15 > [class*="col-"] {
    display: flex;
}

.blog-area .rainbow-card.box-card-style-default {
    width: 100%;
}

.blog-area .rainbow-card.box-card-style-default .inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-area .rainbow-card.box-card-style-default .content {
    flex: 1;
}

/* Ensure title text wraps properly */
.blog-area .rainbow-card .title {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
 * Call-to-Action Section Styles
 * ============================================ */

/* Style-6 CTA (light background) - ensure dark text in light mode */
body.active-light-mode .rainbow-callto-action.style-6 .title,
body.active-light-mode .clltoaction-style-default.style-6 .title,
body.active-light-mode .rainbow-callto-action.style-6 h2,
body.active-light-mode .clltoaction-style-default.style-6 h2 {
    color: #1a1a1a !important;
}

/* Style-8 CTA - dark mode (dark background, light text) */
.rainbow-call-to-action.style-8 .title,
.rainbow-call-to-action.style-8 .title *,
.rainbow-call-to-action.style-8 .subtitle,
.rainbow-call-to-action.style-8 .subtitle * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.rainbow-call-to-action.style-8 .subtitle,
.rainbow-call-to-action.style-8 .subtitle * {
    color: rgba(255, 255, 255, 0.8) !important;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.8) !important;
}

/* Style-8 CTA - light mode (light background, dark text) */
body.active-light-mode .rainbow-call-to-action.style-8 .title,
body.active-light-mode .rainbow-call-to-action.style-8 .title *,
body.active-light-mode .rainbow-call-to-action.style-8 h2,
body.active-light-mode .rainbow-call-to-action.style-8 h2 * {
    color: #1a1a1a !important;
    -webkit-text-fill-color: #1a1a1a !important;
}

body.active-light-mode .rainbow-call-to-action.style-8 .subtitle,
body.active-light-mode .rainbow-call-to-action.style-8 .subtitle *,
body.active-light-mode .rainbow-call-to-action.style-8 h6,
body.active-light-mode .rainbow-call-to-action.style-8 h6 * {
    color: #666666 !important;
    -webkit-text-fill-color: #666666 !important;
}

/* Add proper spacing above CTA button */
.rainbow-call-to-action .call-to-btn,
.rainbow-callto-action .call-to-btn,
.rainbow-call-to-action.style-8 .call-to-btn {
    margin-top: 30px !important;
}

/* ============================================
 * Feature List with Automatic Checkmarks
 * Adds tick marks to list items even without icons in HTML
 * ============================================ */

/* Service card feature lists - add checkmarks via CSS */
.service .list-style--1 li,
.service__style--2 .list-style--1 li {
    position: relative;
    padding-left: 28px;
    display: block;
}

/* Add checkmark before each list item if no icon exists */
.service .list-style--1 li::before,
.service__style--2 .list-style--1 li::before {
    content: '\2713'; /* Unicode checkmark */
    position: absolute;
    left: 0;
    top: 0;
    color: var(--color-primary);
    font-weight: bold;
    font-size: 16px;
}

/* Hide the CSS checkmark if an icon already exists in the li */
.service .list-style--1 li:has(i)::before,
.service__style--2 .list-style--1 li:has(i)::before {
    display: none;
}

/* When li has an icon, use flexbox layout */
.service .list-style--1 li:has(i),
.service__style--2 .list-style--1 li:has(i) {
    padding-left: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* ============================================
 * Service Card Equal Heights
 * Ensures service cards in grid have consistent heights
 * ============================================ */

/* Service cards in row should have equal heights */
.rainbow-service-area .row,
.service-wrapper .row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.rainbow-service-area .row > [class*="col-"],
.service-wrapper .row > [class*="col-"] {
    display: flex;
}

.rainbow-service-area .service,
.rainbow-service-area .service__style--2,
.service-wrapper .service,
.service-wrapper .service__style--2 {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Ensure content area fills available space */
.rainbow-service-area .service .content,
.rainbow-service-area .service__style--2 .content,
.service-wrapper .service .content,
.service-wrapper .service__style--2 .content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Push list/description to fill space evenly */
.rainbow-service-area .service .content p,
.rainbow-service-area .service__style--2 .content p,
.service-wrapper .service .content p,
.service-wrapper .service__style--2 .content p {
    flex: 1;
}

/* Minimum height for service cards - ensures visual consistency */
.rainbow-service-area .service,
.rainbow-service-area .service__style--2,
.service-wrapper .service,
.service-wrapper .service__style--2 {
    min-height: 320px;
}

/* ============================================
 * Contact Address Card Equal Heights
 * Ensures contact info tiles have consistent heights
 * ============================================ */

/* Contact address cards in row should have equal heights */
.rainbow-contact-address .row {
    display: flex;
    flex-wrap: wrap;
}

.rainbow-contact-address .row > [class*="col-"] {
    display: flex;
    margin-bottom: 30px;
}

/* Rainbow address card - equal height styling */
.rainbow-address {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 180px;
}

.rainbow-address .inner {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.rainbow-address .inner p {
    flex: 1;
    margin-bottom: 0;
}

/* ============================================
 * Testimonial Card Theme Colors
 * Ensures testimonial cards use proper theme background
 * ============================================ */

/* Dark mode (default) - use theme's dark background */
.rainbow-box-card.testimonial-style-one,
.testimonial-style-one.style-two {
    background: var(--color-blackest, #0f0f11) !important;
}

.rainbow-box-card.testimonial-style-one .inner,
.testimonial-style-one.style-two .inner {
    background: transparent !important;
}

/* Light mode - use light background */
body.active-light-mode .rainbow-box-card.testimonial-style-one,
body.active-light-mode .testimonial-style-one.style-two {
    background: var(--color-white, #ffffff) !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

body.active-light-mode .rainbow-box-card.testimonial-style-one .inner,
body.active-light-mode .testimonial-style-one.style-two .inner {
    background: transparent !important;
}

/* Ensure border gradient works properly */
.rainbow-box-card.border-gradient {
    position: relative;
    z-index: 1;
}

/* Testimonial/Team card thumbnail gradient background - uses theme primary color */
.rainbow-box-card.border-gradient .thumbnail,
.team-style-default.border-gradient .thumbnail,
.testimonial-style-one.border-gradient .thumbnail {
    background: linear-gradient(
        180deg,
        var(--color-primary, #059DFF) 0%,
        var(--color-secondary, #FB5343) 100%
    ) !important;
}

/* ============================================
 * Print Styles
 * ============================================ */

@media print {
    /* Hide non-essential elements when printing */
    .cms-widget-container,
    .no-print {
        display: none !important;
    }

    /* Ensure content is readable when printed */
    .content,
    .cms-content,
    main {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ensure images print properly */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}
