/* Frontend Styles for Homepage Service Section */

.sv-snippet-section {
    padding: 80px 20px;
    overflow-x: hidden;
}

.sv-snippet-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.sv-snippet-header {
    text-align: center;
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(30px);
    animation: sv-snippet-fadeInUp 1s ease forwards;
}

.sv-snippet-header h2 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: inherit;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.sv-snippet-header p {
    font-size: 1.1rem;
    color: inherit;
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.sv-snippet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.sv-snippet-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.sv-snippet-card:hover {
    transform: translateY(-10px);
    border-color: var(--wp--preset--color--primary, #0073aa);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.sv-snippet-icon {
    width: 70px;
    height: 70px;
    background: var(--wp--preset--color--primary, #0073aa);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    transition: transform 0.3s ease;
}

/* Custom icon colors override default background */
.sv-snippet-icon.custom-icon-colors {
    background: var(--wp--preset--color--primary, #0073aa); /* Default fallback */
}

/* Inline styles will override the above due to higher specificity */

.sv-snippet-card:hover .sv-snippet-icon {
    transform: scale(1.1) rotate(5deg);
}

.sv-snippet-icon i {
    font-size: 1.8rem;
    color: white;
}

.sv-snippet-card h4 {
    font-size: 1.4rem;
    font-weight: 600;
    color: inherit;
    margin-bottom: 15px;
}

.sv-snippet-card p {
    font-size: 0.95rem;
    color: inherit;
    opacity: 0.7;
    line-height: 1.6;
    margin-bottom: 30px;
}

.sv-snippet-arrow {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Custom arrow colors override default background */
.sv-snippet-arrow.custom-arrow-colors {
    background: var(--wp--preset--color--primary, #0073aa); /* Default fallback */
}

.sv-snippet-card:hover .sv-snippet-arrow {
    background: var(--wp--preset--color--primary, #0073aa);
    transform: translate(5px, -5px);
}

/* Custom arrow hover colors */
.sv-snippet-card:hover .sv-snippet-arrow.custom-arrow-colors {
    background: var(--arrow-hover-bg, var(--wp--preset--color--primary, #0073aa));
}

.sv-snippet-arrow i {
    color: #333;
    font-size: 1rem;
    transition: color 0.3s ease;
}

/* Custom arrow icon colors */
.sv-snippet-arrow.custom-arrow-colors i {
    color: inherit;
}

.sv-snippet-card:hover .sv-snippet-arrow i {
    color: white;
}

/* Custom arrow hover icon colors */
.sv-snippet-card:hover .sv-snippet-arrow.custom-arrow-colors i {
    color: var(--arrow-hover-color, white);
}

/* Animation Keyframes */
@keyframes sv-snippet-fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sv-snippet-card.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Editor-specific styles for Gutenberg */
.is-editor .sv-snippet-section {
    padding: 40px 20px;
}

.is-editor .sv-snippet-header {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

.is-editor .sv-snippet-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: all 0.3s ease;
    /* Remove hardcoded colors to allow inline styles */
}

.is-editor .sv-snippet-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.is-editor .sv-snippet-card.is-selected {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.is-editor .sv-snippet-card .service-remove-button:hover {
    background: #a02123 !important;
    transform: scale(1.1);
}

/* Add service card styles */
.is-editor .add-service-card {
    border: 2px dashed #ccc;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
}

.is-editor .add-service-card:hover {
    border-color: #0073aa !important;
    background-color: #f8f9fa !important;
}

.is-editor .add-service-card i {
    display: block;
    font-size: 2rem;
    color: #666;
    margin-bottom: 10px;
}

.is-editor .add-service-card p {
    margin: 0;
    color: #666;
    font-weight: 500;
}

/* Rich text editing styles */
.is-editor .sv-snippet-card .rich-text {
    outline: none;
}

.is-editor .sv-snippet-card .rich-text:focus {
    box-shadow: inset 0 0 0 2px #0073aa;
    border-radius: 4px;
}

.is-editor .sv-snippet-card .rich-text[data-is-placeholder-visible="true"] {
    color: #999;
}

/* Inspector controls enhancement */
.components-panel__body .components-base-control__label {
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sv-snippet-section { 
        padding: 60px 10px; 
    }
    .sv-snippet-grid { 
        grid-template-columns: 1fr; 
    }
    .sv-snippet-header { 
        margin-bottom: 50px; 
    }
    .is-editor .sv-snippet-section { 
        padding: 30px 10px; 
    }
    .is-editor .sv-snippet-grid { 
        grid-template-columns: 1fr; 
    }
    .is-editor .sv-snippet-header { 
        margin-bottom: 50px; 
    }
}

/* Custom color support - ensure inline styles work properly */
.is-editor .sv-snippet-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: inherit;
}

.is-editor .sv-snippet-icon {
    background: var(--wp--preset--color--primary, #0073aa);
}

/* Editor: Custom icon colors override default background */
.is-editor .sv-snippet-icon.custom-icon-colors {
    background: var(--wp--preset--color--primary, #0073aa); /* Default fallback */
}

/* Editor: Inline styles will override the above due to higher specificity */

.is-editor .sv-snippet-icon.custom-icon-colors i {
    color: inherit !important;
}

/* Override for cards with custom colors */
.is-editor .sv-snippet-card[style] {
    background: inherit;
    border-color: inherit;
    color: inherit;
}

/* Frontend: Allow inline styles to set custom icon background colors */
.sv-snippet-icon.custom-icon-colors {
    background: var(--wp--preset--color--primary, #0073aa); /* Default fallback */
}

/* Frontend: Inline styles will override the above due to higher specificity */

.sv-snippet-icon.custom-icon-colors i {
    color: inherit !important;
}
