/*
 * CxPRESS v2 wizard — throwaway baseline styles.
 *
 * The point of this file is only to make the fields legible while we
 * iterate on the field set. Real styling comes later; nothing here is
 * meant to survive a redesign.
 */

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                  Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f8fafc;
    color: #1f2937;
    line-height: 1.4;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 0.75rem 1.5rem;
    background: #111827;
    color: #f9fafb;
}

header .brand { color: #f9fafb; font-weight: 700; text-decoration: none; }
header nav a  { color: #d1d5db; margin-left: 1rem; text-decoration: none; }
header nav a:hover { color: #ffffff; }

main   { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
footer { padding: 1rem 1.5rem; text-align: center; color: #6b7280; }

h1 { margin-top: 0; }
h2 { border-bottom: 1px solid #e5e7eb; padding-bottom: 0.25rem; margin-top: 2rem; }
h3 { margin-top: 1.5rem; }

/* -- Flash messages ------------------------------------------------- */
ul.flash { list-style: none; padding: 0; margin: 0 1.5rem; }
ul.flash li { padding: 0.5rem 0.75rem; margin: 0.5rem 0; border-radius: 4px; }
.flash-info  { background: #dbeafe; color: #1e3a8a; }
.flash-error { background: #fee2e2; color: #7f1d1d; }

/* -- Forms ----------------------------------------------------------- */
fieldset {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    background: #ffffff;
}
legend { padding: 0 0.5rem; font-weight: 600; color: #111827; }

label {
    display: block;
    margin: 0.5rem 0;
}
label.radio { display: flex; align-items: baseline; gap: 0.5rem; font-weight: normal; }
label.row   { display: flex; align-items: center; gap: 0.75rem; }

input[type="text"], input[type="date"], input[type="number"], select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.95rem;
    min-width: 12rem;
}
input[type="file"] { font-size: 0.9rem; }

button, .btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    color: #111827;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
}
button.primary, .btn.primary {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    font-weight: 600;
}
button:hover, .btn:hover { filter: brightness(1.05); }

/* -- Tables ---------------------------------------------------------- */
table {
    border-collapse: collapse;
    width: 100%;
    background: #ffffff;
    margin: 0.75rem 0;
}
th, td {
    border: 1px solid #e5e7eb;
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-size: 0.9rem;
    vertical-align: middle;
}
thead { background: #f3f4f6; }

/* Step table — narrower cell width so numeric inputs sit tight */
table.steps input[type="number"], table.steps input[type="text"] {
    min-width: 5.5rem;
    padding: 0.25rem;
}

/* Session dashboard */
table.sections td { padding: 0.5rem 0.75rem; }

/* Status pills */
.status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-empty     { background: #fef3c7; color: #92400e; }
.status-populated { background: #d1fae5; color: #065f46; }

/* -- Key/value description lists ------------------------------------- */
dl.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
}
dl.kv dt { color: #6b7280; }
dl.kv dd { margin: 0; font-weight: 500; }

/* -- Custom builder inputs grid -------------------------------------- */
fieldset.criteria {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
}

/* Utility */
.hint { color: #4b5563; font-size: 0.9rem; }
.req  { color: #dc2626; }
code  { background: #eef2ff; padding: 0.1rem 0.3rem; border-radius: 3px;
        font-size: 0.85rem; }


/* Dashboard workflow list */
ol.workflow {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}
ol.workflow > li {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
ol.workflow > li strong {
    min-width: 12rem;
}

.status-skipped { background: #e5e7eb; color: #4b5563; }


/* Configure page — one fieldset per test slot */
fieldset.slot {
    background: #f9fafb;
    border-color: #cbd5e1;
}
fieldset.slot legend {
    color: #1e293b;
}

textarea {
    width: 100%;
    max-width: 40rem;
    min-height: 3rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
}

.form-actions {
    margin: 1.5rem 0;
}


button.danger, .btn.danger {
    background: #ffffff;
    border-color: #f87171;
    color: #b91c1c;
}
button.danger:hover, .btn.danger:hover {
    background: #fee2e2;
}

.row-actions {
    white-space: nowrap;
}


/* Configure page — delete button on the right of each slot's legend */
fieldset.slot > legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 1rem);
    gap: 1rem;
}
button.slot-delete {
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 3px;
}

/* Hidden delete forms live outside the main form so nested <form> tags
   are avoided. They're referenced from the slot-delete buttons via the
   HTML "form" attribute. Zero visual footprint. */
form.hidden-delete-form {
    display: none;
}


/* ------------------------------------------------------------------
 * Build-in-progress overlay
 * ---------------------------------------------------------------- */
#build-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
#build-overlay.visible {
    display: flex;
}
.overlay-card {
    background: #ffffff;
    padding: 2rem 2.5rem;
    border-radius: 10px;
    max-width: 32rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}
.overlay-card h2 {
    margin: 1rem 0 0.5rem;
    border-bottom: none;
    color: #1e40af;
}
.overlay-card p {
    margin: 0.5rem 0;
    color: #334155;
}

/* Animated ring spinner */
.spinner {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto;
    border: 5px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}


/* -- Cold Start block (Fase 2 / v1.18.0) ------------------------------ */
.cold-start-block {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #eff6ff;      /* subtle blue tint */
    border: 1px solid #bfdbfe;
    border-radius: 6px;
}
.cold-start-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    margin: 0;
}
.cold-start-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.cold-start-fields {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #bfdbfe;
}
.cold-start-definition {
    margin: 0 0 0.75rem 0;
    color: #1e3a8a;
}
.cold-start-table {
    background: #ffffff;
    border-color: #bfdbfe;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
}
.cold-start-table legend {
    font-weight: 600;
    color: #1e3a8a;
}
.cold-start-18h-check {
    margin-top: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
}
.cold-start-18h-check.cold-start-ok {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}
.cold-start-18h-check.cold-start-warn {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}
.cold-start-18h-check.cold-start-insufficient {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #7f1d1d;
}
.cold-start-18h-check.cold-start-pending {
    background: #e5e7eb;
    border: 1px solid #9ca3af;
    color: #374151;
}
