/* forms.css - wydzielone style aplikacji. */

.table-footer-controls,
.filter-bar,
.global-search-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--panel-padding);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: none;
}

.global-search-panel {
    position: relative;
    margin-bottom: var(--section-gap);
    padding-left: 2.75rem;
}

.global-search-panel input {
    flex: 1 1 18rem;
}

.global-search-icon {
    position: absolute;
    top: 50%;
    left: .95rem;
    display: inline-flex;
    color: var(--muted);
    transform: translateY(-50%);
}

.global-search-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.table-panel .table-footer-controls {
    border-width: 0 0 1px;
    border-radius: 0;
    background: var(--surface-soft);
    box-shadow: none;
}

.table-control,
.form-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--space-xs);
}

.table-control label,
.form-field label,
.field-label {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 950;
    letter-spacing: .08em;
    line-height: 1.35;
    text-transform: uppercase;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
    min-width: min(100%, 12rem);
    min-height: var(--control-height);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: .45rem .62rem;
    font-size: var(--control-font-size);
    font-weight: 650;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover,
textarea:hover {
    border-color: #8fa59e;
}

textarea {
    min-height: 5.8rem;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(0, 108, 73, .12);
}

input[readonly],
input:disabled,
select:disabled,
textarea:disabled {
    background: var(--surface-muted);
    color: #607083;
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--primary);
}

input[type="file"] {
    padding: .55rem;
}

input[type="date"] {
    min-width: min(100%, 11rem);
}

.responsive-form {
    display: grid;
    gap: var(--section-gap);
    padding: var(--panel-padding);
}

.inline-form {
    align-items: end;
}

.filter-grid,
.accounting-filter {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
}

.filter-field,
.filter-actions {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: flex-end;
    gap: .35rem;
}

.filter-field label {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.filter-actions {
    flex-direction: row;
    align-items: end;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--grid-gap);
}

.form-grid.three-columns {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.form-field-wide {
    grid-column: 1 / -1;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-grid.two-columns {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.form-section,
.option-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: var(--panel-padding);
}

.panel > .form-grid,
.panel > .form-field,
.panel > .form-section,
.panel > .option-box {
    margin: 0;
    padding: var(--panel-padding);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding-top: var(--space-sm);
}

.field-hint,
.help-text,
.field-error,
.error-text,
.errorlist {
    font-size: .8rem;
    font-weight: 700;
}

.field-hint {
    margin: .15rem 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.help-text {
    margin: .15rem 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.error-text,
.field-error,
.errorlist {
    color: var(--danger);
}

.field-error {
    display: block;
    margin-top: .15rem;
}

.errorlist {
    list-style: none;
    margin: .25rem 0 0;
    padding: 0;
}

.form-field:has(.errorlist) input,
.form-field:has(.errorlist) select,
.form-field:has(.errorlist) textarea,
.has-error input,
.has-error select,
.has-error textarea {
    border-color: #e15b5b;
    background: var(--danger-soft);
}

.ingredient-form-list,
.ingredient-editor,
.group-grid {
    display: grid;
    gap: .55rem;
    padding: .65rem 0;
}

.ingredient-form-list {
    padding: 0;
}

.recipe-percentage-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ingredient-row-card[hidden] {
    display: none !important;
}

.ingredient-row-card,
.ingredient-line {
    display: grid;
    gap: .55rem;
    align-items: end;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
    padding: .62rem;
}

.ingredient-row-fields {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(7rem, 9rem) auto;
    gap: .55rem;
    align-items: end;
}

.ingredient-line {
    grid-template-columns: minmax(0, 1fr) minmax(7rem, 11rem);
}

.ingredient-line strong,
.ingredient-line span {
    display: block;
}

.ingredient-line span {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 700;
}

.percentage-input {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.section-divider {
    display: flex;
    gap: .55rem;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: .72rem;
}

.section-divider h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 950;
}

.section-divider p {
    margin: .25rem 0 0;
    color: var(--muted);
    font-weight: 650;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .62rem .68rem;
    cursor: pointer;
}

.checkbox-row span,
.checkbox-row strong {
    line-height: 1.45;
}

.warning-option {
    border-color: var(--warning);
    background: var(--warning-soft);
}

.stage-confirm-panel {
    display: grid;
    gap: var(--grid-gap);
    padding: var(--panel-padding);
}

.ingredient-row.is-complete,
.production-stage-table .ingredient-row.is-complete {
    background: var(--success-soft);
    opacity: .82;
}

.line-through {
    text-decoration: line-through;
}

.row-name.is-complete {
    color: var(--success);
}


.auto-resize-field {
    width: auto;
    max-width: 100%;
}

.form-field .auto-resize-field {
    min-width: min(100%, 12ch);
}

.is-muted,
.disabled-cell {
    opacity: .58;
}

.single-event-rows,
.single-event-card {
    display: grid;
    gap: var(--section-gap);
}

.single-event-rows {
    padding: var(--card-padding);
}

.single-event-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: var(--panel-padding);
}

.single-event-details .form-field.is-muted {
    display: none;
}

.disabled-cell {
    background: var(--surface-muted);
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.opacity-40 {
    opacity: .4;
}

.opacity-60 {
    opacity: .6;
}

.opacity-75 {
    opacity: .75;
}


.filter-disclosure,
.form-disclosure {
    margin-bottom: var(--section-gap);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    box-shadow: none;
}

.filter-disclosure > summary,
.form-disclosure > summary {
    display: flex;
    min-height: var(--control-height);
    align-items: center;
    gap: .65rem;
    padding: .62rem var(--panel-padding);
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 950;
    cursor: pointer;
    list-style: none;
}

.filter-disclosure > summary::-webkit-details-marker,
.form-disclosure > summary::-webkit-details-marker {
    display: none;
}

.filter-disclosure > summary::after,
.form-disclosure > summary::after {
    content: "+";
    margin-left: auto;
    color: var(--primary);
    font-size: 1.3rem;
    line-height: 1;
}

.filter-disclosure[open] > summary::after,
.form-disclosure[open] > summary::after {
    content: "−";
}

.filter-disclosure summary small,
.form-disclosure summary small {
    color: var(--muted);
    font-weight: 700;
}

.filter-panel-form {
    margin: 0;
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .55rem var(--panel-padding);
    border-top: 1px solid var(--border);
}

.filter-chip,
.filter-active-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .3rem .55rem;
    font-size: .72rem;
    font-weight: 900;
}

.filter-chip {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.form-section-heading {
    margin-bottom: .25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: .55rem;
}

.form-section-heading h2,
.form-section-heading p {
    margin: 0;
}

.form-section-heading h2 {
    font-size: var(--section-heading-size);
    font-weight: 950;
}

.form-section-heading p {
    margin-top: .25rem;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 650;
}

.dynamic-form-section:not(.hidden) {
    animation: reveal-section .18s ease-out;
}

@keyframes reveal-section {
    from { opacity: 0; transform: translateY(-.35rem); }
    to { opacity: 1; transform: translateY(0); }
}

.form-error-summary ul {
    margin: .45rem 0 0;
}

.empty-inline {
    margin: .65rem 0 0;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: .65rem;
    color: var(--muted);
    text-align: center;
    font-weight: 750;
}

.form-disclosure {
    margin: 0;
    padding: 0;
    box-shadow: none;
}

.form-disclosure > .field-hint,
.form-disclosure > .form-grid,
.form-disclosure > .stats-grid,
.form-disclosure > .dashboard-stat-grid,
.form-disclosure > .summary-list,
.form-disclosure > .ingredient-editor {
    margin: 0;
    padding: var(--panel-padding);
}

.form-disclosure > .finance-section,
.form-disclosure > .finance-grid,
.form-disclosure > .chart-panel,
.form-disclosure > .table-panel {
    margin: var(--panel-padding);
}

.module-visibility-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: var(--grid-gap);
}

.module-visibility-group {
    display: grid;
    gap: var(--space-sm);
    min-width: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: var(--card-padding);
}

.module-visibility-group legend {
    padding-inline: .35rem;
    font-weight: 950;
}

.module-settings-card {
    display: grid;
    min-width: 0;
    gap: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: var(--card-padding);
}

.module-toggle {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    min-width: 0;
    align-items: flex-start;
    gap: .65rem;
    border-radius: var(--radius);
    cursor: pointer;
}

.module-settings-card:hover {
    background: var(--primary-soft);
}

.module-toggle span,
.module-toggle strong,
.module-toggle small,
.module-nav-toggle span {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.module-toggle .module-icon {
    display: inline-flex;
    margin-top: -.15rem;
}

.module-toggle-copy {
    min-width: 0;
}

.module-toggle strong {
    color: var(--text);
    line-height: 1.25;
}

.module-toggle small {
    margin-top: .15rem;
    color: var(--muted);
    line-height: 1.4;
}

.module-nav-toggle {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .55rem;
    border-top: 1px dashed var(--border);
    padding-top: .65rem;
    color: var(--muted);
    cursor: pointer;
    font-size: .84rem;
    font-weight: 850;
    line-height: 1.35;
}

.module-settings-card.is-locked {
    opacity: .72;
}

.module-settings-card.is-locked,
.module-toggle.is-locked {
    cursor: default;
}
