/* ===========================================
   BIRTH CHART BLOCK STYLES
   =========================================== */

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

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

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

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

/* DATETIME INPUT (native datetime-local with flatpickr enhancement) */
.birth-chart-block .ezhp-form input.ezhp-datetime-input,
.birth-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;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

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

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

/* Transit row - checkbox and datetime on same line */
.birth-chart-block .ezhp-transit-row {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.birth-chart-block .ezhp-transit-row .ezhp-transit-label {
    white-space: nowrap;
}

.birth-chart-block .ezhp-transit-row .ezhp-transit-datetime-label {
    white-space: nowrap;
}

.birth-chart-block .ezhp-transit-row .ezhp-transit-datetime-input {
    flex: 1;
    min-width: 200px;
}

/* House System + Button row */
.birth-chart-block .ezhp-house-button-row {
    flex-direction: row;
    align-items: flex-end;
    gap: 1rem;
}

.birth-chart-block .ezhp-house-system-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

/* 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 */
.birth-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;
    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;
}

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

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

/* BUTTON */
.birth-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;
    white-space: nowrap;
}

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

/* Ensure button inherits all theme styles */
.birth-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;
}

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

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

/* CHART IMAGE */
.birth-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 */
.birth-chart-block .ezhp-loading {
    padding: 2rem;
    color: inherit;
    opacity: 0.7;
}

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

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

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

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

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

@media (min-width: 600px) {
    .birth-chart-block .ezhp-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        align-items: end;
    }

    .birth-chart-block .ezhp-form-row {
        min-width: 0;
    }

    /* Row 1: datetime left, location right */
    .birth-chart-block .ezhp-datetime-row {
        grid-column: 1;
        grid-row: 1;
    }

    .birth-chart-block .ezhp-location-row {
        grid-column: 2;
        grid-row: 1;
    }

    /* Row 2: transit datetime left, checkbox right */
    .birth-chart-block .ezhp-transit-datetime-row {
        grid-column: 1;
        grid-row: 2;
    }

    .birth-chart-block .ezhp-transit-row {
        grid-column: 2;
        grid-row: 2;
        align-self: end;
        padding-bottom: 0.5rem;
    }

    /* Row 3: house system left, button right */
    .birth-chart-block .ezhp-house-row {
        grid-column: 1;
        grid-row: 3;
    }

    .birth-chart-block .ezhp-button-row {
        grid-column: 2;
        grid-row: 3;
        align-self: end;
    }
}