/* Routines tab and routine editor steps. Loaded after styles/app-shell.css. */

/* ---------- Routine editor helpers ---------- */

.routine-booking-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #fff6ed;
    border-left: 3px solid var(--kind-routine);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.routine-editor-tools {
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem;
}

.routine-cards-empty .btn {
    margin: 0.25rem 0.25rem 0 0;
}

/* ---------- Routines tab ---------- */

#routine .routine-container,
#routine .routine-view {
    width: 100%;
}

#routine .routine-view.hidden {
    display: none !important;
}

.routine-card-info {
    color: var(--on-surface);
    background: var(--surface);
}

#routine .routine-view-controls .routine-view-btn.active {
    background: var(--primary-color);
    color: var(--on-primary);
    opacity: 1;
}

/* ---------- Routine editor: steps ---------- */

.routine-reorder-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0.5rem;
}

#routine-edit-modal-tasks-list {
    max-height: none;
    overflow: visible;
    border: none;
    padding: 0;
}

.routine-tasks-editor-list .routine-task-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.routine-tasks-editor-list .routine-task-item input.task-name {
    min-height: 44px;
    font-size: 16px;
    border: 1px solid transparent;
    background: transparent;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    width: 100%;
}

.routine-tasks-editor-list .routine-task-item input.task-name:focus {
    border-color: var(--primary-light);
    background: #faf7ff;
    outline: none;
}

.routine-drag-handle,
.routine-step-toggle,
.routine-step-move {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.routine-drag-handle {
    cursor: grab;
    touch-action: none; /* finger drag moves the step, not the page */
    font-size: 1.1rem;
}

.routine-drag-handle:active {
    cursor: grabbing;
}

.routine-drag-handle:hover,
.routine-step-toggle:hover,
.routine-step-move:hover {
    background: #f3eefe;
    color: var(--primary-color);
}

.routine-step-toggle i {
    transition: transform 0.15s ease;
}

.routine-task-item.open .routine-step-toggle i {
    transform: rotate(180deg);
}

.routine-step-details {
    grid-column: 1 / -1;
    display: none;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.25rem 0.1rem 3rem;
}

.routine-task-item.open {
    border-color: var(--primary-light);
    box-shadow: 0 2px 10px rgba(98, 0, 238, 0.12);
}

.routine-task-item.open .routine-step-details {
    display: flex;
}

.task-duration-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 auto 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.routine-tasks-editor-list .task-duration-label input.task-duration {
    width: 72px;
    min-height: 44px;
    font-size: 16px;
    text-align: center;
}

.routine-tasks-editor-list .btn-remove-task {
    width: 44px;
    height: 44px;
    color: #b3261e;
}

.routine-task-item.dragging {
    opacity: 0.9;
    background: #f3eefe;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    position: relative;
    z-index: 2;
}

.routine-tasks-editor-list.is-sorting {
    user-select: none;
}

.routine-task-item.moved {
    animation: routine-step-moved 0.6s ease;
}

@keyframes routine-step-moved {
    from { background: #e8def8; }
    to { background: var(--surface); }
}

/* Larger screens: every step shows its duration and options on one line. */

@media (min-width: 769px) {
    .routine-tasks-editor-list .routine-task-item {
        grid-template-columns: 44px minmax(0, 1fr) auto;
    }

    .routine-step-toggle {
        display: none;
    }

    .routine-step-details,
    .routine-task-item.open .routine-step-details {
        grid-column: auto;
        display: flex;
        padding: 0;
    }
}
