/* SkylarkAds Gutenberg Block Styles */

/* Editor Styles */
.wp-block-skylarkads-gutenberg {
    position: relative;
    min-height: 200px;
    overflow: hidden;
    border: 2px dashed #ddd;
}

.wp-block-skylarkads-gutenberg:hover {
    border-color: #007cba;
}

.wp-block-skylarkads-gutenberg.is-selected {
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* Draggable elements in editor */
.wp-block-skylarkads-gutenberg .skylarkads-gutenberg__title,
.wp-block-skylarkads-gutenberg .skylarkads-gutenberg__subtitle,
.wp-block-skylarkads-gutenberg .skylarkads-gutenberg__cta {
    position: absolute;
    z-index: 10;
}

.wp-block-skylarkads-gutenberg .skylarkads-gutenberg__title:hover,
.wp-block-skylarkads-gutenberg .skylarkads-gutenberg__subtitle:hover,
.wp-block-skylarkads-gutenberg .skylarkads-gutenberg__cta:hover {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Editor placeholder styles */
.wp-block-skylarkads-gutenberg .components-placeholder {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border: 2px dashed #ddd;
}

.wp-block-skylarkads-gutenberg .components-placeholder .components-placeholder__label {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wp-block-skylarkads-gutenberg .components-placeholder .components-placeholder__instructions {
    margin-bottom: 16px;
    color: #666;
}

/* Frontend Styles */
.skylarkads-gutenberg {
    position: relative;
    overflow: hidden;
    display: block;
    width: 100%;
}

/* Override theme fonts for ALL text elements in banner to match WordPress editor */
.skylarkads-gutenberg,
.skylarkads-gutenberg *,
.skylarkads-gutenberg h1,
.skylarkads-gutenberg h2,
.skylarkads-gutenberg h3,
.skylarkads-gutenberg h4,
.skylarkads-gutenberg h5,
.skylarkads-gutenberg h6,
.skylarkads-gutenberg p,
.skylarkads-gutenberg span,
.skylarkads-gutenberg div,
.skylarkads-gutenberg a {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

.skylarkads-gutenberg__image {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Background image properties are set inline via JavaScript */
}

.skylarkads-gutenberg__title {
    position: absolute;
    z-index: 3;
    margin: 0;
    font-weight: bold;
    line-height: 1.2;
    /* Override theme font to match WordPress editor */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

.skylarkads-gutenberg__subtitle {
    position: absolute;
    z-index: 3;
    margin: 0;
    line-height: 1.4;
    /* Override theme font to match WordPress editor */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

.skylarkads-gutenberg__cta {
    position: absolute;
    z-index: 3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .skylarkads-gutenberg {
        min-height: 250px;
    }

    .skylarkads-gutenberg__title {
        font-size: 1.5em !important;
        max-width: 90%;
    }

    .skylarkads-gutenberg__subtitle {
        font-size: 1em !important;
        max-width: 90%;
    }

    .skylarkads-gutenberg__cta {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .skylarkads-gutenberg {
        min-height: 200px;
    }

    .skylarkads-gutenberg__title {
        font-size: 1.2em !important;
    }

    .skylarkads-gutenberg__subtitle {
        font-size: 0.9em !important;
    }
}

/* Alignment Classes */
.skylarkads-gutenberg.alignwide {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.skylarkads-gutenberg.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Button styling within CTA */
.skylarkads-gutenberg__cta .wp-block-button {
    margin: 0;
}

/* Ensure ALL WordPress blocks within banner use editor fonts */
.skylarkads-gutenberg .wp-block-paragraph,
.skylarkads-gutenberg .wp-block-heading,
.skylarkads-gutenberg .wp-block-list,
.skylarkads-gutenberg .wp-block-quote,
.skylarkads-gutenberg .wp-block-verse,
.skylarkads-gutenberg .wp-block-preformatted,
.skylarkads-gutenberg .wp-block-code,
.skylarkads-gutenberg .wp-block-pullquote,
.skylarkads-gutenberg .wp-block-table,
.skylarkads-gutenberg .wp-block-buttons,
.skylarkads-gutenberg .wp-block-button,
.skylarkads-gutenberg .wp-block-group,
.skylarkads-gutenberg .wp-block-columns,
.skylarkads-gutenberg .wp-block-column {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

.skylarkads-gutenberg__cta .wp-block-button__link {
    text-decoration: none;
    /* Use WordPress default padding */
    padding: calc(.667em + 2px) calc(1.333em + 2px);
    /* Override theme font to match WordPress admin editor */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    /* Set base font-size to match WordPress editor body (18px) so em calculations work correctly */
    font-size: calc(1.125 * 18px) !important; /* 1.125em calculated from 18px base like in editor */
    box-sizing: border-box !important;
    transition: all 0.3s ease;
}

.skylarkads-gutenberg__cta .wp-block-button__link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Text shadow for better readability over images */
.skylarkads-gutenberg__title,
.skylarkads-gutenberg__subtitle {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Editor specific styles for better UX */
.block-editor-block-list__layout .wp-block-skylarkads-gutenberg {
    margin: 28px 0;
}

/* Inspector controls styling */
.skylarkads-gutenberg-inspector .components-color-picker {
    margin-bottom: 16px;
}

.skylarkads-gutenberg-inspector .components-range-control {
    margin-bottom: 16px;
}

/* Dragging state */
.skylarkads-gutenberg-dragging {
    cursor: grabbing !important;
    user-select: none;
}

.skylarkads-gutenberg-dragging * {
    pointer-events: none;
}

/* Focus states for accessibility */
.skylarkads-gutenberg__title:focus,
.skylarkads-gutenberg__subtitle:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Loading state */
.skylarkads-gutenberg.is-loading {
    opacity: 0.6;
}

.skylarkads-gutenberg.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007cba;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    z-index: 10;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wp-block-skylarkads-gutenberg {
        border-color: #000;
    }

    .skylarkads-gutenberg__title,
    .skylarkads-gutenberg__subtitle {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .skylarkads-gutenberg__cta .wp-block-button__link {
        transition: none;
    }

    .skylarkads-gutenberg__cta .wp-block-button__link:hover {
        transform: none;
    }

    .skylarkads-gutenberg.is-loading::after {
        animation: none;
    }
}

/* Print styles */
@media print {
    .skylarkads-gutenberg {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Background images don't need special print styles */
}
