/* ACT Bestillingsskjema v1.7.4 */

#act-order-wrap { max-width:100%; font-family:inherit; }
.act-intro { margin-bottom:1.2em; font-size:0.9rem; }

/* ── Meta grid — 4 col → 2 col → 1 col ── */
.act-meta-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px 20px;
    margin-bottom: 1.5em;
}
.act-meta-grid label {
    display: flex !important;
    flex-direction: column !important;
    font-weight: 600;
    font-size: 0.875rem;
    gap: 4px;
}
.act-meta-grid label.act-full-width { grid-column: 1 / -1 !important; }
.act-meta-grid input,
.act-meta-grid textarea {
    font-weight: 400;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
}
.act-meta-grid textarea { min-height: 70px; resize: vertical; }

@media (max-width: 900px) {
    .act-meta-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 480px) {
    .act-meta-grid {
        grid-template-columns: 1fr !important;
    }
    .act-meta-grid label.act-full-width {
        grid-column: 1 !important;
    }
}

/* ── Legend — 2 col → 1 col on mobile ── */
.act-legend {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px;
    margin-bottom: 1.4em;
}
.act-legend-box {
    background: #f7f8fa;
    border: 1px solid #e0e3e8;
    border-radius: 6px;
    padding: 10px 14px 10px;
}
.act-legend-box h4 {
    margin: 0 0 7px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #555 !important;
    border-bottom: 1px solid #dde0e6;
    padding-bottom: 5px;
}
.act-legend-box dl {
    display: grid !important;
    grid-template-columns: max-content 1fr !important;
    column-gap: 10px;
    row-gap: 1px;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.75rem;
    line-height: 1.65;
}
.act-legend-box dt {
    display: block !important;
    float: none !important;
    font-weight: 700 !important;
    color: #222 !important;
    white-space: nowrap;
    padding: 0 !important;
    margin: 0 !important;
}
.act-legend-box dd {
    display: block !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #333;
    white-space: nowrap;
}
.act-note { font-size: 0.7rem; color: #999; font-style: italic; }
.act-note-foot { margin-top: 6px; display: block; }

@media (max-width: 480px) {
    .act-legend {
        grid-template-columns: 1fr !important;
    }
}

/* ── Spreadsheet — full-width breakout ── */
#act-spreadsheet {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    box-sizing: border-box;
    /* Dynamic padding: generous on large screens, tighter as viewport shrinks */
    padding: 0 clamp(12px, 4vw, 60px);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.2em;
}
#act-spreadsheet .jexcel_content { overflow: visible !important; }
#act-spreadsheet .jexcel_container { overflow: visible !important; }

/* Hide the blank resize-handle row (2nd tr in thead) — NOT the title row */
#act-spreadsheet table > thead > tr:nth-child(2),
#act-spreadsheet table > thead > tr:nth-child(2) td {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Header title row — wrap but never break mid-word */
#act-spreadsheet table > thead > tr:nth-child(1) td {
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
    text-align: center !important;
    vertical-align: bottom !important;
    line-height: 1.25 !important;
    padding: 4px 5px !important;
}

/* Data cell padding */
#act-spreadsheet table tbody td {
    padding-left: 5px !important;
    padding-right: 5px !important;
}

/* Restore correct row stripe colors */
#act-spreadsheet table tbody tr td {
    background-color: #ffffff !important;
}
#act-spreadsheet table tbody tr:nth-child(even) td {
    background-color: #f3f3f3 !important;
}

/* ── Actions ── */
.act-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 1em;
}
#act-submit {
    padding: 10px 28px;
    background: #00aeef;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
#act-submit:hover { background: #0099d4; }
#act-submit:disabled { background: #999; cursor: not-allowed; }

/* ── Tøm skjema-knapp ── */
#act-clear {
    padding: 10px 22px;
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
#act-clear:hover {
    background: #f5f5f5;
    border-color: #aaa;
    color: #333;
}

.act-row-hint { font-size: 0.8rem; color: #666; }

/* ── Status ── */
#act-status { padding: 12px 16px; border-radius: 4px; font-weight: 600; margin-top: 0.8em; }
.act-status-success { background: #e6f4ea; color: #1e6b32; border: 1px solid #a8d5b5; }
.act-status-error { background: #fdecea; color: #b3261e; border: 1px solid #f5c6c4; }
