/* ============================================================================
   Bootstrap form components — modernised under app theme
   Used by form.html plus any page using Bootstrap's `.card`, `.form-control`,
   `.btn` etc. Brings them in line with the m-card / m-btn aesthetic.
   ============================================================================ */

/* Bootstrap `.card` → m-card-style surface */
body.app .card {
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    box-shadow: var(--m-shadow-xs);
    margin-bottom: 16px;
    overflow: hidden;
}
body.app .card > .card-header,
body.app .card-header {
    background: var(--m-surface);
    color: var(--m-text);
    border-bottom: 1px solid var(--m-divider);
    padding: 14px 20px;
    font-family: var(--m-font);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
body.app .card-header strong { font-weight: 600; }
body.app .card-header small {
    color: var(--m-text-muted);
    font-weight: 400;
    margin-left: 4px;
}
body.app .card-body {
    padding: 20px;
}
body.app .card-title {
    font-family: var(--m-font);
    font-size: 16px;
    font-weight: 600;
    color: var(--m-text);
    margin: 0 0 12px;
    text-transform: none;
}
body.app .card-footer {
    background: var(--m-surface-2);
    border-top: 1px solid var(--m-divider);
    padding: 14px 20px;
}

/* Form group spacing */
body.app .form-group { margin-bottom: 16px; }
body.app .form-group:last-child { margin-bottom: 0; }

/* Labels */
body.app .form-control-label,
body.app .control-label,
body.app form label:not(.form-check-label):not(.au-checkbox):not(.btn) {
    font-family: var(--m-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--m-text);
    margin: 0 0 6px;
    display: inline-block;
}

/* Inputs / textareas / selects */
body.app .form-control,
body.app input.form-control,
body.app textarea.form-control,
body.app select.form-control,
body.app .form-select {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    background-color: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: 8px;
    font-family: var(--m-font);
    font-size: 14px;
    color: var(--m-text);
    line-height: 1.4;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    outline: none;
    box-shadow: none;
}
body.app textarea.form-control {
    height: auto;
    min-height: 96px;
    padding: 10px 14px;
    line-height: 1.5;
    resize: vertical;
}
body.app .form-control::placeholder,
body.app .form-select::placeholder {
    color: var(--m-text-faint);
}
body.app .form-control:focus,
body.app .form-select:focus {
    border-color: var(--m-accent);
    box-shadow: 0 0 0 3px rgba(var(--m-accent-rgb), 0.15);
    outline: none;
}
body.app .form-control[readonly],
body.app .form-control[disabled],
body.app .form-control:disabled {
    background-color: var(--m-surface-2);
    color: var(--m-text-muted);
    cursor: not-allowed;
}

/* File input */
body.app input[type="file"].form-control {
    padding: 7px 12px;
    line-height: 1.4;
}
body.app input[type="file"]::file-selector-button {
    background: var(--m-surface-2);
    border: 1px solid var(--m-border);
    border-radius: 6px;
    color: var(--m-text);
    padding: 4px 12px;
    margin: 0 12px 0 -8px;
    font-family: var(--m-font);
    font-size: 12.5px;
    cursor: pointer;
    transition: background 120ms ease;
}
body.app input[type="file"]::file-selector-button:hover {
    background: var(--m-divider);
}

/* Static / plaintext value */
body.app .form-control-plaintext {
    color: var(--m-text);
    font-family: var(--m-font);
    font-size: 14px;
    padding: 8px 0;
    margin: 0;
}

/* Help text */
body.app .help-block,
body.app .form-text {
    color: var(--m-text-muted);
    font-family: var(--m-font);
    font-size: 12.5px;
    margin-top: 4px;
    display: block;
}

/* Validation states */
body.app .has-success .form-control,
body.app .form-control.is-valid,
body.app .form-control-success {
    border-color: var(--m-success);
}
body.app .has-success .form-control:focus,
body.app .form-control.is-valid:focus,
body.app .form-control-success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
body.app .has-warning .form-control,
body.app .form-control-warning {
    border-color: var(--m-warning);
}
body.app .has-warning .form-control:focus,
body.app .form-control-warning:focus {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.20);
}
body.app .has-danger .form-control,
body.app .form-control.is-invalid,
body.app .form-control-danger {
    border-color: var(--m-danger);
}
body.app .has-danger .form-control:focus,
body.app .form-control.is-invalid:focus,
body.app .form-control-danger:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.20);
}
body.app .has-success .help-block { color: var(--m-success); }
body.app .has-warning .help-block { color: var(--m-warning); }
body.app .has-danger  .help-block { color: var(--m-danger); }

/* Input group (icon prefix / button suffix) */
body.app .input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    border-radius: 8px;
}
body.app .input-group > .form-control {
    flex: 1 1 auto;
    border-radius: 0;
}
body.app .input-group > :first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
body.app .input-group > :last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}
body.app .input-group-text,
body.app .input-group-prepend > .input-group-text,
body.app .input-group-append > .input-group-text {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--m-surface-2);
    border: 1px solid var(--m-border);
    color: var(--m-text-muted);
    font-family: var(--m-font);
    font-size: 13px;
    line-height: 1;
}
body.app .input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(var(--m-accent-rgb), 0.15);
}

/* Form-check (checkbox / radio) — Bootstrap 5 native */
body.app .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 0;
    margin-bottom: 8px;
    min-height: auto;
}
body.app .form-check-inline {
    display: inline-flex;
    margin-right: 16px;
    margin-bottom: 0;
}
body.app .form-check-input {
    margin: 0;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--m-border);
    border-radius: 4px;
    background-color: var(--m-surface);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
body.app .form-check-input[type="radio"] {
    border-radius: 50%;
}
body.app .form-check-input:hover {
    border-color: var(--m-accent);
}
body.app .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(var(--m-accent-rgb), 0.18);
    border-color: var(--m-accent);
    outline: none;
}
body.app .form-check-input:checked {
    background-color: var(--m-accent);
    border-color: var(--m-accent);
}
body.app .form-check-label {
    font-family: var(--m-font);
    font-size: 13.5px;
    color: var(--m-text);
    cursor: pointer;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Form-actions (button row) */
body.app .form-actions,
body.app .form-actions.form-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--m-divider);
    margin-top: 8px;
    margin-bottom: 0;
}

/* Bootstrap `.btn` family — map BS color variants to brand palette */
body.app .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-family: var(--m-font);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
body.app .btn:active { transform: translateY(0.5px); }
body.app .btn:focus,
body.app .btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--m-accent-rgb), 0.18);
}
body.app .btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
body.app .btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }

body.app .btn-primary,
body.app .btn-info {
    background: var(--m-accent);
    color: #fff;
    border-color: var(--m-accent);
}
body.app .btn-primary:hover,
body.app .btn-info:hover {
    background: var(--m-accent-hover);
    color: #fff;
    border-color: var(--m-accent-hover);
}

body.app .btn-secondary {
    background: var(--m-surface);
    color: var(--m-text);
    border-color: var(--m-border);
}
body.app .btn-secondary:hover {
    background: var(--m-surface-2);
    color: var(--m-text);
    border-color: var(--m-border);
}

body.app .btn-success {
    background: var(--m-success);
    color: #fff;
    border-color: var(--m-success);
}
body.app .btn-success:hover { background: #0d9d6e; border-color: #0d9d6e; color: #fff; }

body.app .btn-warning {
    background: var(--m-warning);
    color: #fff;
    border-color: var(--m-warning);
}
body.app .btn-warning:hover { background: #e08a06; border-color: #e08a06; color: #fff; }

body.app .btn-danger {
    background: var(--m-danger);
    color: #fff;
    border-color: var(--m-danger);
}
body.app .btn-danger:hover { background: #d83838; border-color: #d83838; color: #fff; }

/* Outline button variants */
body.app .btn-outline-primary,
body.app .btn-outline-info {
    background: transparent;
    color: var(--m-accent);
    border-color: var(--m-accent);
}
body.app .btn-outline-primary:hover,
body.app .btn-outline-info:hover {
    background: var(--m-accent);
    color: #fff;
}
body.app .btn-outline-secondary {
    background: transparent;
    color: var(--m-text);
    border-color: var(--m-border);
}
body.app .btn-outline-secondary:hover {
    background: var(--m-surface-2);
    color: var(--m-text);
}
body.app .btn-outline-success { background: transparent; color: var(--m-success); border-color: var(--m-success); }
body.app .btn-outline-success:hover { background: var(--m-success); color: #fff; }
body.app .btn-outline-warning { background: transparent; color: var(--m-warning); border-color: var(--m-warning); }
body.app .btn-outline-warning:hover { background: var(--m-warning); color: #fff; }
body.app .btn-outline-danger  { background: transparent; color: var(--m-danger);  border-color: var(--m-danger); }
body.app .btn-outline-danger:hover { background: var(--m-danger); color: #fff; }

/* Button group + toolbar */
body.app .btn-group {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    isolation: isolate;
}
body.app .btn-group > .btn {
    border-radius: 0;
    margin-left: -1px;
}
body.app .btn-group > .btn:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; margin-left: 0; }
body.app .btn-group > .btn:last-child  { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

/* Dropdown toggle — keep aligned with btn family */
body.app .dropdown-toggle::after {
    border-top-color: currentColor;
    margin-left: 6px;
}
body.app .dropdown-menu {
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    box-shadow: var(--m-shadow-lg);
    padding: 6px;
    font-family: var(--m-font);
    font-size: 13px;
}
body.app .dropdown-item {
    padding: 7px 12px;
    border-radius: 6px;
    color: var(--m-text);
    transition: background 120ms ease;
}
body.app .dropdown-item:hover,
body.app .dropdown-item:focus {
    background: var(--m-surface-2);
    color: var(--m-text);
}
body.app .dropdown-divider {
    border-color: var(--m-divider);
    margin: 4px 0;
}

/* Bootstrap "row mb-3" form rows — tighten label-input alignment */
body.app form .row.mb-3 {
    align-items: center;
    margin-bottom: 16px;
}
body.app form .row.mb-3 > [class*="col-md-3"] label {
    margin-bottom: 0;
    color: var(--m-text-muted);
    font-weight: 500;
}

/* Legacy `.au-input` (used in CC payment form) — match new input styling */
body.app .au-input {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    background-color: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: 8px;
    font-family: var(--m-font);
    font-size: 14px;
    color: var(--m-text);
    transition: border-color 120ms ease, box-shadow 120ms ease;
    outline: none;
}
body.app .au-input:focus {
    border-color: var(--m-accent);
    box-shadow: 0 0 0 3px rgba(var(--m-accent-rgb), 0.15);
}
body.app .au-input--xl { height: 42px; }

/* `<hr>` inside cards — softer divider */
body.app .card hr {
    border: 0;
    border-top: 1px solid var(--m-divider);
    margin: 16px 0;
}

/* Fieldset legend */
body.app fieldset {
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    padding: 16px 20px;
    margin: 0 0 16px;
}
body.app fieldset legend {
    font-family: var(--m-font);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--m-text);
    padding: 0 8px;
    width: auto;
    margin-bottom: 0;
}


/* Calendar event-types legend */
body.app .legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
body.app .legend-list > li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-family: var(--m-font);
    font-size: 13px;
    color: var(--m-text);
}
body.app .legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* FullCalendar 7 — app theme.
   v7 generates hashed class names, so there is nothing stable to target here.
   Colors are rebound via the theme's --fc-classic-* custom properties in
   src/pug/partials/content/calendar.styles.html. Only layout-level rules that
   sit OUTSIDE the calendar's own markup belong in this file. */
body.app .calendar-container { padding: 4px; }
body.app .fc {
    font-family: var(--m-font);
}


