/* Shared styles for row-based editors (Schedule, Exercise, Medication) */

/* Editor container */
[data-editor] {
    display: flex;
    flex-direction: column;
}

/* Mobile: title row hidden */
.editor-title-row {
    display: none;
}

/* Rows container */
.editor-rows {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Individual row */
.editor-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Mobile header (label + remove btn) */
.editor-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Mobile label — standalone labels get bottom margin, labels inside header don't */
.editor-mobile-label {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
}

.editor-mobile-header > .editor-mobile-label {
    margin-bottom: 0;
}

/* Remove row button */
.remove-row-btn {
    font-size: 30px;
    line-height: 1;
}

/* Add row button */
.add-row-btn {
    align-self: flex-start;
    padding: 0;
    margin-top: 15px;
    font-size: 14px;
}

/* Custom section (Exercise, Medication) */
.custom-editor-section {
    margin-top: 30px;
}

.custom-section-divider {
    border-top: 1px solid var(--bs-border-color);
    margin-bottom: 20px;
}

.custom-section-mobile-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Time group columns (Schedule editors) */
.editor-time-group {
    display: flex;
    gap: 10px;
}

.editor-col-start,
.editor-col-end {
    flex: 1;
}

/* Validation overrides for custom inputs inside editor rows */
.editor-row .form-select.is-invalid {
    border-color: var(--bs-danger);
}

.editor-row .form-control.is-invalid {
    border-color: var(--bs-danger);
    background-image: none;
}

/* Tablet+ */
@media (min-width: 768px) {
    .editor-title-row {
        display: flex;
        flex-direction: row;
        gap: 10px;
        padding-right: 24px;
        margin-bottom: 20px;
    }

    .editor-row {
        flex-direction: row;
        align-items: center;
        padding-right: 24px;
        position: relative;
    }

    .editor-mobile-header {
        display: contents;
    }

    .editor-mobile-label {
        display: none;
        font-size: 20px;
    }

    .remove-row-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        right: -7px;
    }

    .add-row-btn {
        font-size: 20px;
    }

    .custom-section-divider {
        display: none;
    }

    .custom-section-mobile-title {
        display: none;
        font-size: 20px;
    }

    .custom-section-title {
        margin-top: 10px;
    }

    .editor-time-group {
        flex: 1;
    }

    /* Medication "auto-add to diary" toggle — full-width row under the inline medication row */
    .medication-row,
    .custom-medication-row {
        flex-wrap: wrap;
    }

    .medication-col-daily {
        flex-basis: 100%;
        margin-left: 0;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .editor-time-group {
        flex: none;
    }

    .editor-col-start,
    .editor-col-end {
        width: 200px;
        flex: none;
    }
}

/* Large desktop */
@media (min-width: 1280px) {
    .editor-col-start,
    .editor-col-end {
        width: 270px;
    }
}