/**
 * Peaks Prescriptions - Twenty Twenty-Five Theme Compatibility
 * Ensures seamless integration with WordPress block themes
 */

/* Use theme content width variables */
.peaks-prescriptions {
    --peaks-content-width: var(--wp--style--global--content-size, 1200px);
    --peaks-wide-width: var(--wp--style--global--wide-size, 1400px);
    max-width: var(--peaks-wide-width);
    margin-left: auto;
    margin-right: auto;
}

/* Reset theme styles that might interfere */
.peaks-prescriptions *,
.peaks-prescriptions *::before,
.peaks-prescriptions *::after {
    box-sizing: border-box;
}

/* Inherit theme typography for headers */
.peaks-header h1 {
    font-family: var(--wp--preset--font-family--heading, inherit);
}

/* Ensure proper z-index layering with theme */
.peaks-modal-overlay {
    z-index: 100000;
}

.peaks-toast-container {
    z-index: 100001;
}

/* Fix any theme form styling conflicts */
.peaks-prescriptions input,
.peaks-prescriptions button,
.peaks-prescriptions select {
    font-family: inherit;
    font-size: inherit;
}

/* Override theme button defaults */
.peaks-prescriptions .peaks-btn {
    font-family: inherit;
    background-image: none;
    box-shadow: none;
    text-shadow: none;
    text-decoration: none;
}

.peaks-prescriptions .peaks-btn:hover,
.peaks-prescriptions .peaks-btn:focus {
    background-image: none;
    text-decoration: none;
}

/* Ensure inputs don't inherit theme styles */
.peaks-prescriptions input[type="text"],
.peaks-prescriptions input[type="date"],
.peaks-prescriptions input[type="email"],
.peaks-prescriptions input[type="search"] {
    background-image: none;
    border-style: solid;
}

/* Override link styles inside plugin */
.peaks-prescriptions a {
    text-decoration: none;
}

.peaks-prescriptions a:hover {
    text-decoration: underline;
}

/* Fix potential spacing issues from theme */
.peaks-prescriptions p {
    margin-top: 0;
}

.peaks-prescriptions h1,
.peaks-prescriptions h2,
.peaks-prescriptions h3,
.peaks-prescriptions h4 {
    margin-top: 0;
    line-height: 1.4;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .peaks-prescriptions *,
    .peaks-prescriptions *::before,
    .peaks-prescriptions *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .peaks-prescriptions {
        --peaks-border: currentColor;
    }

    .peaks-status-badge {
        border: 1px solid currentColor;
    }

    .peaks-prescription-card {
        border: 2px solid currentColor;
    }
}

/* Focus visible support for keyboard navigation */
.peaks-prescriptions button:focus-visible,
.peaks-prescriptions a:focus-visible,
.peaks-prescriptions input:focus-visible {
    outline: 2px solid var(--peaks-primary, #6366f1);
    outline-offset: 2px;
}

/* Ensure proper stacking in FSE templates */
.wp-site-blocks .peaks-prescriptions {
    position: relative;
    z-index: 1;
}

/* Fix potential overflow issues */
.peaks-prescriptions {
    overflow-x: hidden;
}

/* Ensure modal works in block themes */
body.peaks-prescriptions-page .wp-site-blocks {
    overflow: visible;
}

/* Admin bar spacing when on prescription page */
body.admin-bar .peaks-toast-container {
    top: calc(1.5rem + 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .peaks-toast-container {
        top: calc(1.5rem + 46px);
    }
}
