/* CMS Card Component Styles */

/* ==========================================
   Base Card Block Styling
   ========================================== */
.cms-card-block {
    position: relative;
    display: block;
    margin-bottom: 16px;
}

/* ==========================================
   Column Span Classes (Grid Integration)
   ========================================== */
.cms-col-span-1 { max-width: 8.333%; }
.cms-col-span-2 { max-width: 16.666%; }
.cms-col-span-3 { max-width: 25%; }
.cms-col-span-4 { max-width: 33.333%; }
.cms-col-span-5 { max-width: 41.666%; }
.cms-col-span-6 { max-width: 50%; }
.cms-col-span-7 { max-width: 58.333%; }
.cms-col-span-8 { max-width: 66.666%; }
.cms-col-span-9 { max-width: 75%; }
.cms-col-span-10 { max-width: 83.333%; }
.cms-col-span-11 { max-width: 91.666%; }
.cms-col-span-12 { max-width: 100%; }

/* ==========================================
   Card Wrapper & Link
   ========================================== */
.cms-card-wrapper {
    display: block;
    height: 100%;
}

.cms-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.cms-card-link:hover {
    text-decoration: none;
    color: inherit;
}

/* ==========================================
   Card Base Styling
   ========================================== */
.cms-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cms-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* ==========================================
   Card Header & Image
   ========================================== */
.cms-card-header {
    padding: 0;
    overflow: hidden;
}

.cms-card-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.cms-card-link:hover .cms-card-img {
    transform: scale(1.05);
}

/* Vertical Card Image */
.cms-card-vertical .cms-card-header .cms-card-img {
    max-height: 240px;
}

/* ==========================================
   Card Body Content
   ========================================== */
.cms-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cms-card-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #0d5d2c; /* EAA Forest Green */
}

.cms-card-description {
    color: rgba(0, 0, 0, 0.7);
    line-height: 1.6;
    flex-grow: 1;
}

/* ==========================================
   Card Actions & Button
   ========================================== */
.cms-card-actions {
    padding: 16px;
    padding-top: 8px;
}

.cms-card-button {
    background-color: #f0b323; /* EAA Gold */
    color: #ffffff;
    font-weight: 600;
    text-transform: none;
}

.cms-card-button:hover {
    background-color: #d9a520;
}

/* ==========================================
   Card Variants
   ========================================== */

/* Vertical Card (Default) */
.cms-card-vertical {
    flex-direction: column;
}

/* Horizontal Card */
.cms-card-horizontal-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.cms-card-horizontal-image {
    flex: 0 0 40%;
    max-width: 40%;
    overflow: hidden;
}

.cms-card-horizontal-image .cms-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cms-card-horizontal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Minimal Card (No Image) */
.cms-card-minimal {
    /* No specific styles - just uses default card layout without header */
}

/* ==========================================
   Edit Mode Styling
   ========================================== */
.cms-card-edit {
    position: relative;
    min-height: 200px;
}

.cms-card-empty {
    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;
}

.cms-card-preview {
    position: relative;
}

.cms-card-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.cms-card-preview:hover .cms-card-overlay {
    opacity: 1;
}

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

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

/* Mobile (xs): Always vertical, full width */
@media (max-width: 599px) {
    .cms-card-block {
        max-width: 100% !important;
    }

    .cms-card-horizontal-container {
        flex-direction: column;
    }

    .cms-card-horizontal-image {
        flex: 0 0 auto;
        max-width: 100%;
        max-height: 200px;
    }

    .cms-card-img {
        max-height: 200px;
    }
}

/* Small (sm): 2-column grid */
@media (min-width: 600px) and (max-width: 959px) {
    .cms-card-block {
        max-width: 50%;
    }

    .cms-card-horizontal-container {
        flex-direction: column;
    }

    .cms-card-horizontal-image {
        flex: 0 0 auto;
        max-width: 100%;
        max-height: 200px;
    }
}

/* Medium+ (md+): Respect column span and horizontal layout */
@media (min-width: 960px) {
    .cms-card-horizontal-container {
        flex-direction: row;
    }

    .cms-card-horizontal-image {
        flex: 0 0 40%;
        max-width: 40%;
    }
}

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

.cms-card-button:focus {
    outline: 2px solid #f0b323;
    outline-offset: 2px;
}

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

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

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

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

    .cms-card:hover {
        transform: none;
    }

    .cms-card-link:hover .cms-card-img {
        transform: none;
    }
}

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

    .cms-card {
        box-shadow: none;
        page-break-inside: avoid;
    }

    .cms-card-link {
        color: inherit;
    }
}

/* ==========================================
   Card Grid Container (for multiple cards)
   ========================================== */
.cms-card-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ==========================================
   Hover Effects for Clickable Cards
   ========================================== */
.cms-card-link .cms-card {
    cursor: pointer;
}

.cms-card-link:hover .cms-card {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}
