/**
 * WPBakery Image Card Element Styles - SVG ARROW VERSION
 * File: assets/css/image-card.css
 * Version: 1.4.0 - Fixed button alignment for multi-line titles
 */

/* ==========================================================================
   Base Card Styles - FLEXBOX FOR PROPER ALIGNMENT
   ========================================================================== */

.custom-image-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none;
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    max-width: 400px;
    display: flex !important;
    flex-direction: column !important;
    height: 100%; /* CRITICAL: Ensures equal heights in grid */
}

.custom-image-card * {
    box-sizing: border-box;
}

/* ==========================================================================
   Card Widths
   ========================================================================== */

.custom-image-card.card-width-small {
    max-width: 300px;
}

.custom-image-card.card-width-default {
    max-width: 400px;
}

.custom-image-card.card-width-medium {
    max-width: 450px;
}

.custom-image-card.card-width-large {
    max-width: 500px;
}

.custom-image-card.card-width-full {
    max-width: 100%;
}

/* ==========================================================================
   Icon Sizes
   ========================================================================== */

.custom-image-card.icon-size-small .card-icon,
.custom-image-card.icon-size-small i {
    font-size: 32px !important;
}

.custom-image-card.icon-size-medium .card-icon,
.custom-image-card.icon-size-medium i {
    font-size: 48px !important;
}

.custom-image-card.icon-size-large .card-icon,
.custom-image-card.icon-size-large i {
    font-size: 64px !important;
}

.custom-image-card.icon-size-extra-large .card-icon,
.custom-image-card.icon-size-extra-large i {
    font-size: 80px !important;
}

/* ==========================================================================
   Image Aspect Ratios - WITH ROUNDED CORNERS
   ========================================================================== */

.card-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: 12px 12px 0 0;
    display: block;
    padding-bottom: 56.25%; /* DEFAULT: 16:9 aspect ratio */
    min-height: 200px;
    flex-shrink: 0; /* CRITICAL: Prevents image from shrinking */
}

.custom-image-card.image-ratio-16-9 .card-image-wrapper {
    padding-bottom: 56.25%; /* 16:9 */
}

.custom-image-card.image-ratio-4-3 .card-image-wrapper {
    padding-bottom: 75%; /* 4:3 */
}

.custom-image-card.image-ratio-1-1 .card-image-wrapper {
    padding-bottom: 100%; /* 1:1 */
}

.custom-image-card.image-ratio-3-2 .card-image-wrapper {
    padding-bottom: 66.67%; /* 3:2 */
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.card-image.lazy-load {
    opacity: 0.3 !important;
}

.card-image.loaded {
    opacity: 1 !important;
}

/* ==========================================================================
   Card Content - FLEXBOX FOR BUTTON ALIGNMENT
   ========================================================================== */

.card-content {
    padding: 25px;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important; /* CRITICAL: Allows content to grow */
    background: #ffffff;
    min-height: 0; /* CRITICAL: Allows flex children to shrink */
}

.card-title {
    margin: 0 0 20px 0;
    font-weight: 600;
    line-height: 1.3;
    color: #333333;
    flex-shrink: 0; /* CRITICAL: Prevents title from being compressed */
}

.card-description {
    margin: 0 0 25px 0;
    line-height: 1.6;
    color: #666666;
    flex: 0 1 auto; /* CRITICAL: Allows description to shrink if needed */
}

.card-description p {
    margin: 0 0 10px 0;
}

.card-description p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Text Alignment
   ========================================================================== */

.custom-image-card.text-align-left {
    text-align: left;
}

.custom-image-card.text-align-center {
    text-align: center;
}

.custom-image-card.text-align-right {
    text-align: right;
}

/* ==========================================================================
   Typography Sizes - EXPANDED OPTIONS
   ========================================================================== */

/* Title Font Sizes - More granular options */
.card-title.title-size-extra-small {
    font-size: 16px;
}

.card-title.title-size-small {
    font-size: 18px;
}

.card-title.title-size-medium {
    font-size: 20px;
}

.card-title.title-size-medium-large {
    font-size: 22px;
}

.card-title.title-size-large {
    font-size: 24px;
}

.card-title.title-size-extra-large {
    font-size: 28px;
}

.card-title.title-size-huge {
    font-size: 32px;
}

/* Responsive title sizes */
@media (max-width: 768px) {
    .card-title.title-size-extra-small {
        font-size: 15px;
    }
    
    .card-title.title-size-small {
        font-size: 16px;
    }
    
    .card-title.title-size-medium {
        font-size: 18px;
    }
    
    .card-title.title-size-medium-large {
        font-size: 19px;
    }
    
    .card-title.title-size-large {
        font-size: 20px;
    }
    
    .card-title.title-size-extra-large {
        font-size: 22px;
    }
    
    .card-title.title-size-huge {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .card-title.title-size-extra-small {
        font-size: 14px;
    }
    
    .card-title.title-size-small {
        font-size: 15px;
    }
    
    .card-title.title-size-medium {
        font-size: 16px;
    }
    
    .card-title.title-size-medium-large {
        font-size: 17px;
    }
    
    .card-title.title-size-large {
        font-size: 18px;
    }
    
    .card-title.title-size-extra-large {
        font-size: 20px;
    }
    
    .card-title.title-size-huge {
        font-size: 22px;
    }
}

/* Title Font Weights */
.card-title.title-weight-normal {
    font-weight: 400;
}

.card-title.title-weight-medium {
    font-weight: 500;
}

.card-title.title-weight-semi-bold {
    font-weight: 600;
}

.card-title.title-weight-bold {
    font-weight: 700;
}

/* Description Font Sizes */
.card-description.desc-size-small {
    font-size: 14px;
}

.card-description.desc-size-medium {
    font-size: 16px;
}

.card-description.desc-size-large {
    font-size: 18px;
}

/* ==========================================================================
   Card Styles
   ========================================================================== */

.custom-image-card.card-style-default {
    box-shadow: none;
    border: none;
}

.custom-image-card.card-style-bordered {
    border: 1px solid #e0e0e0;
}

.custom-image-card.card-style-shadow {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-image-card.card-style-minimal {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   BUTTON STYLES - FULL WIDTH WITH SVG ARROW - ALIGNED TO BOTTOM
   ========================================================================== */

.card-button-wrapper {
    margin-top: auto !important; /* CRITICAL: Pushes button to bottom */
    width: 100% !important;
    display: block !important;
    padding: 0 !important;
    flex-shrink: 0 !important; /* CRITICAL: Prevents button from shrinking */
}

/* Full Width Button with Centered Content */
.card-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    gap: 8px !important;
    background: #5cb3a1 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 16px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0 !important;
}

/* Button Text */
.button-text {
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    color: #ffffff !important;
}

/* SVG Arrow Styling */
.button-arrow-svg {
    display: inline-flex;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.button-arrow-svg path {
    stroke: currentColor;
}

/* Hover effects */
.card-button:hover {
    background: #4a9d8a !important;
    transform: translateY(-2px);
}

.card-button:hover .button-arrow-svg {
    transform: translateX(4px);
}

/* Shimmer effect */
.card-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
    z-index: 1;
}

.card-button:hover::before {
    left: 100%;
}

/* Focus states */
.card-button:focus,
.card-button:active,
.card-button:visited {
    color: #ffffff !important;
    text-decoration: none !important;
    outline: none;
}

.card-button:focus {
    outline: 3px solid rgba(92, 179, 161, 0.3);
    outline-offset: 2px;
}

/* Button Alignment Classes */
.custom-image-card.button-align-left .card-button {
    justify-content: flex-start !important;
}

.custom-image-card.button-align-center .card-button {
    justify-content: center !important;
}

.custom-image-card.button-align-right .card-button {
    justify-content: flex-end !important;
}

.custom-image-card.button-align-full .card-button {
    width: 100% !important;
    justify-content: center !important;
}

/* Button Style Variations */
.card-button.button-style-solid {
    background: #5cb3a1 !important;
    color: #ffffff !important;
    border: none;
}

.card-button.button-style-outline {
    background: transparent !important;
    border: 2px solid #5cb3a1 !important;
    color: #5cb3a1 !important;
}

.card-button.button-style-outline .button-text,
.card-button.button-style-outline .button-arrow-svg {
    color: #5cb3a1 !important;
}

.card-button.button-style-outline:hover {
    background: #5cb3a1 !important;
    color: #ffffff !important;
}

.card-button.button-style-outline:hover .button-text,
.card-button.button-style-outline:hover .button-arrow-svg {
    color: #ffffff !important;
}

.card-button.button-style-ghost {
    background: rgba(92, 179, 161, 0.1) !important;
    border: 1px solid rgba(92, 179, 161, 0.3) !important;
    color: #5cb3a1 !important;
}

.card-button.button-style-ghost .button-text,
.card-button.button-style-ghost .button-arrow-svg {
    color: #5cb3a1 !important;
}

.card-button.button-style-ghost:hover {
    background: rgba(92, 179, 161, 0.2) !important;
    border-color: #5cb3a1 !important;
}

.card-button.button-style-text {
    background: transparent !important;
    border: none !important;
    color: #5cb3a1 !important;
    text-decoration: underline !important;
    text-underline-offset: 4px;
    padding: 8px 0;
}

.card-button.button-style-text .button-text {
    color: #5cb3a1 !important;
}

.card-button.button-style-text:hover {
    color: #4a9d8a !important;
    text-decoration: none !important;
}

.card-button.button-style-text:hover .button-text {
    color: #4a9d8a !important;
}

.card-button.button-style-text .button-arrow-svg {
    display: none;
}

/* ==========================================================================
   Hover Animations
   ========================================================================== */

.custom-image-card.hover-enabled:hover {
    transform: translateY(-4px);
}

.custom-image-card.hover-enabled:hover.card-style-shadow {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.custom-image-card.hover-animation-float-up:hover {
    transform: translateY(-8px);
}

.custom-image-card.hover-animation-scale:hover {
    transform: scale(1.03);
}

.custom-image-card.hover-animation-none:hover {
    transform: none;
}

/* ==========================================================================
   Entrance Animations
   ========================================================================== */

.custom-image-card.animate-ready {
    opacity: 0;
    transform: translateY(30px);
}

.custom-image-card.animate-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.custom-image-card.entrance-animation-fade-in.animate-in {
    animation: fadeIn 0.6s ease forwards;
}

.custom-image-card.entrance-animation-slide-up.animate-in {
    animation: slideUp 0.6s ease forwards;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Three Cards Row Layout - EQUAL HEIGHT SUPPORT
   ========================================================================== */

.three-cards-row,
.responsive-cards-row {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
    align-items: stretch; /* CRITICAL: Makes all cards equal height */
}

.three-cards-row .custom-image-card,
.responsive-cards-row .custom-image-card {
    margin-bottom: 0;
    max-width: 100%;
    height: 100%; /* CRITICAL: Makes cards fill their grid cell */
}

/* Force equal heights when option is enabled */
.three-cards-row.equal-heights .custom-image-card,
.responsive-cards-row.equal-heights .custom-image-card {
    display: flex !important;
    flex-direction: column !important;
}

.three-cards-row.equal-heights .card-content,
.responsive-cards-row.equal-heights .card-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.three-cards-row.equal-heights .card-button-wrapper,
.responsive-cards-row.equal-heights .card-button-wrapper {
    margin-top: auto !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .card-button {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .button-arrow-svg {
        width: 17px;
        height: 17px;
    }
    
    .three-cards-row,
    .responsive-cards-row {
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .custom-image-card {
        max-width: 100%;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .card-title {
        margin-bottom: 15px;
    }
    
    .card-description {
        margin-bottom: 20px;
    }
    
    .card-button {
        font-size: 15px;
        padding: 14px 22px;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .button-text {
        font-size: 15px;
    }
    
    .button-arrow-svg {
        width: 16px;
        height: 16px;
    }
    
    .three-cards-row,
    .responsive-cards-row {
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .card-content {
        padding: 16px;
    }
    
    .card-title {
        margin-bottom: 12px;
    }
    
    .card-description {
        margin-bottom: 16px;
    }
    
    .card-button {
        font-size: 14px;
        padding: 12px 20px;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    .button-text {
        font-size: 14px;
    }
    
    .button-arrow-svg {
        width: 15px;
        height: 15px;
    }
    
    .three-cards-row,
    .responsive-cards-row {
        gap: 15px;
    }
}

/* ==========================================================================
   Accessibility and Special States
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .card-button,
    .button-arrow-svg,
    .custom-image-card,
    .card-image {
        transition: none !important;
        animation: none !important;
    }
    
    .card-button:hover {
        transform: none !important;
    }
    
    .card-button:hover .button-arrow-svg {
        transform: none !important;
    }
    
    .card-button::before {
        display: none !important;
    }
    
    .custom-image-card:hover {
        transform: none !important;
    }
}

@media (prefers-contrast: high) {
    .card-button {
        border: 2px solid currentColor !important;
    }
    
    .button-arrow-svg path {
        stroke: currentColor;
        stroke-width: 3;
    }
    
    .custom-image-card {
        border: 2px solid currentColor;
    }
}

@media (prefers-color-scheme: dark) {
    .button-arrow-svg path {
        stroke: currentColor;
    }
}

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

@media print {
    .card-button {
        border: 1px solid #5cb3a1 !important;
        color: #5cb3a1 !important;
        background: transparent !important;
    }
    
    .button-arrow-svg {
        display: none !important;
    }
    
    .custom-image-card {
        box-shadow: none !important;
        border: 1px solid #e0e0e0 !important;
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   RTL Language Support
   ========================================================================== */

[dir="rtl"] .card-button {
    flex-direction: row-reverse;
}

[dir="rtl"] .button-arrow-svg {
    transform: rotate(180deg);
}

[dir="rtl"] .card-button:hover .button-arrow-svg {
    transform: rotate(180deg) translateX(-4px);
}

/* ==========================================================================
   FORCE PROPER FLEXBOX BEHAVIOR - CRITICAL FOR ALIGNMENT
   ========================================================================== */

.custom-image-card,
.three-cards-row .custom-image-card,
.responsive-cards-row .custom-image-card {
    display: flex !important;
    flex-direction: column !important;
}

.custom-image-card .card-content,
.three-cards-row .card-content,
.responsive-cards-row .card-content {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
}

.custom-image-card .card-button-wrapper,
.three-cards-row .card-button-wrapper,
.responsive-cards-row .card-button-wrapper {
    margin-top: auto !important;
    flex-shrink: 0 !important;
}

.custom-image-card .card-button,
.three-cards-row .card-button,
.responsive-cards-row .card-button {
    gap: 8px !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.custom-image-card .button-text,
.three-cards-row .button-text,
.responsive-cards-row .button-text {
    margin: 0 !important;
    padding: 0 !important;
}

.custom-image-card .button-arrow-svg,
.three-cards-row .button-arrow-svg,
.responsive-cards-row .button-arrow-svg {
    margin: 0 !important;
    padding: 0 !important;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.card-image.lazy-load {
    filter: blur(5px);
    opacity: 0.5;
}

.card-image.loaded {
    filter: blur(0);
    opacity: 1;
}

.card-image.progressive-load {
    filter: blur(10px);
    opacity: 0.7;
}

.card-image.progressive-load.loaded {
    filter: blur(0);
    opacity: 1;
}

/* ==========================================================================
   Debug Mode - Uncomment to visualize flexbox layout
   ========================================================================== */

/*
.custom-image-card {
    outline: 2px solid red;
}

.card-content {
    outline: 2px solid blue;
}

.card-button-wrapper {
    outline: 2px solid green;
}

.card-title {
    outline: 1px dashed orange;
}

.card-description {
    outline: 1px dashed purple;
}
*/

/* ==========================================================================
   End of File
   ==========================================================================  */