/* CMS Container/Section Component Styles */

/* ==========================================
   Base Container Styling
   ========================================== */
.cms-container-wrapper {
    position: relative;
    width: 100%;
}

.cms-container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    transition: all 0.3s ease;
}

/* ==========================================
   Container Variants
   ========================================== */

/* Full-Width Section */
.cms-container-fullwidth {
    width: 100%;
}

/* Contained Section */
.cms-container-contained {
    width: 100%;
}

/* Multi-Column Container */
.cms-container-multicolumn {
    width: 100%;
}

/* ==========================================
   Inner Wrapper (for max-width constraint)
   ========================================== */
.cms-container-inner {
    width: 100%;
    margin: 0 auto;
}

/* ==========================================
   Grid Layout (for multi-column)
   ========================================== */
.cms-container-grid {
    display: grid;
    width: 100%;
}

/* ==========================================
   Padding Sizes
   ========================================== */
.cms-container-padding-small {
    padding: 16px;
}

.cms-container-padding-medium {
    padding: 32px;
}

.cms-container-padding-large {
    padding: 48px;
}

.cms-container-padding-extralarge {
    padding: 64px;
}

/* ==========================================
   Vertical Alignment
   ========================================== */
.cms-container-align-top {
    justify-content: flex-start;
}

.cms-container-align-center {
    justify-content: center;
}

.cms-container-align-bottom {
    justify-content: flex-end;
}

/* ==========================================
   Placeholder (Empty State)
   ========================================== */
.cms-container-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background-color: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
}

/* ==========================================
   Edit Mode
   ========================================== */
.cms-container-edit {
    position: relative;
}

.cms-container-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.cms-container-edit:hover .cms-container-overlay {
    opacity: 1;
}

.cms-container-overlay .mud-icon-button {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cms-container-edit-mode {
    outline: 1px dashed rgba(13, 93, 44, 0.3); /* EAA Forest Green */
    outline-offset: -1px;
}

/* ==========================================
   Background Image Support
   ========================================== */
.cms-container[style*="background-image"] {
    position: relative;
}

/* Optional: Add overlay for better text readability on background images */
.cms-container-with-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 0;
}

.cms-container-with-overlay > * {
    position: relative;
    z-index: 1;
}

/* ==========================================
   Responsive Behavior
   ========================================== */

/* xs: Always 1 column, reduced padding */
@media (max-width: 599px) {
    .cms-container-padding-medium {
        padding: 24px 16px;
    }

    .cms-container-padding-large {
        padding: 32px 16px;
    }

    .cms-container-padding-extralarge {
        padding: 40px 16px;
    }

    .cms-container-grid {
        grid-template-columns: 1fr !important;
    }
}

/* sm: Max 2 columns, medium padding */
@media (min-width: 600px) and (max-width: 959px) {
    .cms-container-padding-large {
        padding: 40px 24px;
    }

    .cms-container-padding-extralarge {
        padding: 48px 24px;
    }

    .cms-container-grid[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .cms-container-grid[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* md+: Full column count, configurable padding */
@media (min-width: 960px) {
    /* Full column count respected */
}

/* ==========================================
   Drop Zone Highlight (for drag-and-drop)
   ========================================== */
.cms-container-dropzone {
    outline: 2px solid #f0b323; /* EAA Gold */
    outline-offset: -2px;
    background-color: rgba(240, 179, 35, 0.1);
}

.cms-container-dropzone-active {
    outline: 3px solid #f0b323;
    outline-offset: -3px;
    background-color: rgba(240, 179, 35, 0.2);
}

/* ==========================================
   Accessibility
   ========================================== */
.cms-container:focus-within {
    outline: 2px solid #f0b323; /* EAA Gold */
    outline-offset: 2px;
}

/* ==========================================
   Animation & Transitions
   ========================================== */
.cms-container-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   Nested Container Support (Max Depth: 2)
   ========================================== */
.cms-container .cms-container {
    margin-top: 16px;
    margin-bottom: 16px;
}

.cms-container .cms-container .cms-container {
    /* Prevent nesting beyond 2 levels */
    pointer-events: none;
    opacity: 0.5;
}

/* ==========================================
   Reduced Motion Support
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    .cms-container,
    .cms-container-overlay {
        transition: none;
    }

    .cms-container-content {
        animation: none;
    }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .cms-container-overlay,
    .cms-container-edit-mode {
        display: none;
    }

    .cms-container {
        page-break-inside: avoid;
    }
}

/* ==========================================
   Utility Classes
   ========================================== */

/* Full-bleed background (extends beyond max-width) */
.cms-container-full-bleed {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Text overlay for better readability on background images */
.cms-container-text-overlay {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Dark overlay variant */
.cms-container-dark-overlay::before {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Light overlay variant */
.cms-container-light-overlay::before {
    background-color: rgba(255, 255, 255, 0.7);
}
