/* ===========================================
   SYNASTRY CHART BLOCK STYLES
   =========================================== */

/* FORM (uses theme fonts + colors) */
.synastry-chart-block .ezhp-form {
    margin: 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: transparent !important;
}

.synastry-chart-block .ezhp-form-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.synastry-chart-block .ezhp-label {
    font: inherit;
    font-weight: 600;
    color: inherit;
}

/* PERSON SECTIONS */
.synastry-chart-block .ezhp-person-section {
    padding: 1rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.02);
    margin-bottom: 0.5rem;
}

.synastry-chart-block .ezhp-person-a-section {
    border-left: 4px solid #2563eb;
}

.synastry-chart-block .ezhp-person-b-section {
    border-left: 4px solid #dc2626;
}

.synastry-chart-block .ezhp-person-heading {
    margin: 0 0 0.75rem 0;
    font-size: 1.1em;
    font-weight: 600;
}

.synastry-chart-block .ezhp-person-a-heading {
    color: #2563eb;
}

.synastry-chart-block .ezhp-person-b-heading {
    color: #dc2626;
}

/* NAME INPUT */
.synastry-chart-block .ezhp-form input[type="text"].ezhp-name-input-a,
.synastry-chart-block .ezhp-form input[type="text"].ezhp-name-input-b {
    font: inherit;
    color: inherit;
    background: inherit;
    border: 1px solid currentColor;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    max-width: 400px;
    opacity: 0.8;
}

.synastry-chart-block .ezhp-form input[type="text"].ezhp-name-input-a:focus,
.synastry-chart-block .ezhp-form input[type="text"].ezhp-name-input-b:focus {
    opacity: 1;
    outline: 2px solid #007cba;
    outline-offset: 1px;
}

/* LOCATION INPUT */
.synastry-chart-block .ezhp-form input[type="text"].ezhp-location-input-a,
.synastry-chart-block .ezhp-form input[type="text"].ezhp-location-input-b {
    font: inherit;
    color: inherit;
    background: inherit;
    border: 1px solid currentColor;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    max-width: 400px;
}

/* DATETIME INPUT (native datetime-local with flatpickr enhancement) */
.synastry-chart-block .ezhp-form input.ezhp-datetime-input-a,
.synastry-chart-block .ezhp-form input.ezhp-datetime-input-b,
.synastry-chart-block .ezhp-form input[type="datetime-local"] {
    font: inherit;
    color: inherit;
    background: inherit;
    border: 1px solid currentColor;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Ensure the input is visible */
.synastry-chart-block .ezhp-form input.ezhp-datetime-input-a,
.synastry-chart-block .ezhp-form input.ezhp-datetime-input-b {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 40px;
}

/* Legacy datetime-local support */
.synastry-chart-block .ezhp-form input[type="datetime-local"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 40px;
}

/* Flatpickr calendar styling overrides */
.flatpickr-calendar {
    font-family: inherit;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: #007cba;
    border-color: #007cba;
}

.flatpickr-months .flatpickr-month {
    background: #007cba;
    color: #fff;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: #007cba;
}

.flatpickr-weekdays {
    background: #007cba;
}

.flatpickr-weekday {
    color: #fff;
}

/* HOUSE SYSTEM SELECT */
.synastry-chart-block .ezhp-form select.ezhp-house-system-select {
    font: inherit;
    color: inherit;
    background: inherit;
    border: 1px solid currentColor;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.synastry-chart-block .ezhp-form select.ezhp-house-system-select:focus {
    outline: 2px solid #007cba;
    outline-offset: 1px;
}

/* Ensure select is visible */
.synastry-chart-block .ezhp-form select.ezhp-house-system-select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 40px;
}

/* BUTTON */
.synastry-chart-block .ezhp-form button.ezhp-fetch-button {
    font: inherit;
    color: inherit;
    background: inherit;
    border: 1px solid currentColor;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    width: fit-content;
    margin-top: 0.5rem;
}

.synastry-chart-block .ezhp-form button.ezhp-fetch-button:hover {
    opacity: 0.8;
}

/* Ensure button inherits all theme styles */
.synastry-chart-block .ezhp-form .wp-element-button {
    font: inherit;
    color: inherit;
    background: inherit;
    border: inherit;
    padding: var(--wp--custom--button--padding, 0.5rem 1rem);
    border-radius: inherit;
}

.synastry-chart-block .ezhp-form .wp-element-button {
    appearance: none;
    -webkit-appearance: none;
}

/* RESULT CONTAINER */
.synastry-chart-block .synastry-chart-result {
    margin-top: 1.5rem;
    text-align: center;
}

/* CHART IMAGE */
.synastry-chart-block .ezhp-chart-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* LOADING STATE */
.synastry-chart-block .ezhp-loading {
    padding: 2rem;
    color: inherit;
    opacity: 0.7;
}

/* ERROR STATE */
.synastry-chart-block .ezhp-error {
    padding: 1rem;
    color: #d63638;
    background: rgba(214, 54, 56, 0.1);
    border-radius: 4px;
}

/* ===========================================
   EDITOR PREVIEW STYLES
   =========================================== */

.synastry-chart-block .synastry-chart-preview {
    min-height: 200px;
    border: 1px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synastry-chart-block .synastry-chart-preview img {
    max-width: 100%;
    height: auto;
}

/* ===========================================
   RESPONSIVE STYLES
   =========================================== */

@media (min-width: 768px) {
    .synastry-chart-block .ezhp-synastry-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .synastry-chart-block .ezhp-person-section {
        margin-bottom: 0;
    }

    /* House system selector spans full width */
    .synastry-chart-block .ezhp-form-row:has(.ezhp-house-system-select) {
        grid-column: 1 / -1;
    }

    /* Button spans full width */
    .synastry-chart-block .ezhp-form button.ezhp-fetch-button {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (min-width: 1024px) {
    .synastry-chart-block .ezhp-form input[type="text"],
    .synastry-chart-block .ezhp-form input[type="datetime-local"],
    .synastry-chart-block .ezhp-form select {
        max-width: 100%;
    }
}

/* ===========================================
   RTL SUPPORT
   =========================================== */

[dir="rtl"] .synastry-chart-block .ezhp-person-a-section {
    border-left: none;
    border-right: 4px solid #2563eb;
}

[dir="rtl"] .synastry-chart-block .ezhp-person-b-section {
    border-left: none;
    border-right: 4px solid #dc2626;
}

[dir="rtl"] .synastry-chart-block .ezhp-form select.ezhp-house-system-select {
    background-position: left 0.75rem center;
    padding-right: 0.75rem;
    padding-left: 2.5rem;
}

/* ===========================================
   DARK MODE SUPPORT
   =========================================== */

@media (prefers-color-scheme: dark) {
    .synastry-chart-block .ezhp-person-section {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Theme dark mode class support */
.dark .synastry-chart-block .ezhp-person-section,
.theme-dark .synastry-chart-block .ezhp-person-section,
[data-theme="dark"] .synastry-chart-block .ezhp-person-section {
    background: rgba(255, 255, 255, 0.05);
}