/* Basic page layout */
:root{
    --bg: #f3f4f6;       /* gray-100 */
    --panel-bg: #ffffff;
    --muted: #4b5563;    /* gray-600 */
    --border: #d1d5db;   /* gray-300 */
    --orange: #f97316;   /* orange-500 */
    --orange-dark: #ea580c;
    --text: #111827;
    --shadow: 0 6px 18px rgba(16,24,40,0.08);
    --radius: 0.5rem;
    --gap: 1.5rem;
}

body.page-bg {
    background-color: var(--bg);
    padding: 1.5rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    margin: 0;
}

/* Container grid */
.container {
    max-width: 96rem; /* ~6xl */
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
}

/* Panels */
.panel {
    background: var(--panel-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Typography */
.heading {
    font-size: 1.125rem; /* text-lg */
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Spacing utilities */
.form-space { display:block; }
.mt-2 { margin-top: .5rem; }
.mb-2 { margin-bottom: .5rem; }
.full-width { width: 100%; }

/* Two-column inside form (for upload labels) */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

/* Dropzone labels */
.dropzone {
    display:flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s ease;
    color: inherit;
    background: #fff;
}

.dropzone:hover {
    border-color: var(--orange);
}

.plus {
    color: var(--orange);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
}

/* Hidden file input */
.hidden-input {
    display: none;
}

/* Button */
.btn-primary {
    display:inline-block;
    background: var(--orange);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background-color .12s ease;
}

.btn-primary:hover {
    background: var(--orange-dark);
}

/* Inputs and textareas */
.input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    box-sizing: border-box;
    font-size: 0.95rem;
    background: #fff;
    color: var(--text);
}

/* Readonly inputs/textareas - greyed out */
input.input[readonly],
textarea.textarea[readonly] {
    background: #f5f5f5;
    color: var(--muted);
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 1;
}


.textarea {
    min-height: 4.5rem;
    resize: vertical;
}

/* Small muted text */
.muted {
    color: var(--muted);
    font-size: 0.875rem;
}

/* Right column layout helper */
.right-column {
    display: block;
}

/* Checkbox group */
.three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .375rem;
    font-size: 0.95rem;
}

.checkbox {
    margin: 0;
    margin-right: .25rem;
    transform: translateY(1px);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .two-col { grid-template-columns: 1fr; }
    .three-col { grid-template-columns: repeat(3, 1fr); } /* stays same but stacks if needed */
}

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center;
}
.hidden { display: none; }
.modal-content { background: white; padding: 20px; border-radius: 8px; width: 300px; text-align: center; }
.progress-bar { width: 100%; height: 20px; background: #eee; border-radius: 10px; overflow: hidden; }
.progress-fill { width: 0%; height: 100%; background: #4caf50; transition: width 0.2s; }

 .selected-files {
     display: flex;
     flex-wrap: wrap;
     gap: 5px;
     margin-bottom: 10px;
 }
.file-label {
    background: #f5f5f5;
    border-radius: 6px;
    padding: 4px 8px;
    margin: 3px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.file-label .remove {
    color: #c00;
    cursor: pointer;
    margin-left: 8px;
}
.file-toggle {
    color: #007bff;
    cursor: pointer;
    text-align: center;
    font-size: 0.9em;
}

.file-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1em;
    font-weight: 500;
    padding: 6px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid #ccc; /* line under summary */
}

.file-summary span:first-child {
    flex-grow: 1;
    text-align: left;
}

.file-summary .clear-all {
    color: #c00;
    cursor: pointer;
    margin-left: 10px;
    font-size: 1.1em;
    line-height: 1;
    transition: color 0.2s;
}

.file-summary .clear-all:hover {
    color: #900;
}

.file-divider {
    border: none;
    border-top: 1px solid #ccc;
    margin: 6px 0;
}

.file-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f8f8;
    border-radius: 6px;
    padding: 4px 8px;
    margin: 4px 0;
}

.file-label .remove {
    color: #c00;
    cursor: pointer;
    margin-left: 10px;
}

.file-label .remove:hover {
    color: #900;
}

.file-toggle {
    display: block;
    text-align: center;
    color: #007bff;
    cursor: pointer;
    font-size: 0.9em;
    margin-top: 6px;
}


/* Form group: simple vertical layout for label + input */
.form-group {
    display: block;
    margin-bottom: 0.75rem;
}

/* Label styling */
.form-group > label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}

/* Optional "required" indicator when input has required attribute */
.form-group > label::after {
    content: "";
    margin-left: 0.35rem;
    color: var(--orange);
    font-weight: 700;
    font-size: 0.95rem;
}

/* Add a visible star when the associated input is required */
.form-group > input[required] + label,
.form-group > label[data-required="true"] {
    /* fallback if you want to mark via label attribute */
}
.form-group > label:has(+ input[required])::after {
    content: "*";
}

/* Input tweaks for the form-group (works with existing .input class) */
.form-group .input {
    transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

/* Focus state */
.form-group .input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.08);
}

/* Placeholder tone */
.form-group .input::placeholder {
    color: #9ca3af; /* gray-400 */
}


/* Small helper / error text under the input (optional) */
.form-group .help {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.875rem;
    color: var(--muted);
}

/* Error state */
.form-group.error .input {
    border-color: #dc2626; /* red-600 */
    box-shadow: 0 0 0 3px rgba(220,38,38,0.06);
}
.form-group.error .help {
    color: #dc2626;
}