/* --- General & Variables --- */
:root {
    --color-bg: #f8fafc;
    --color-text: #1f2937;
    --color-primary: #e78c22;
    --color-secondary: #7d4a4f;
    --color-accent: #0f8dbf;
    --color-muted: #94a3b8;
    --color-white: #ffffff;
    --color-error: #c0392b;
    --color-success: #27ae60;
    --font-family: 'Manrope', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: transparent;
    color: inherit;
    line-height: 1.6;
}

.container {
    max-width: none;
    margin: 0;
    padding: 0;
}

header h1 {
    color: inherit;
    text-align: left;
    margin-bottom: 0;
}

header a {
    text-decoration: none;
}



footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* --- Buttons & Forms --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(15,23,42,0.08);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: #d17a25;
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-white);
}

.btn-secondary:hover {
    background-color: #6d3f46;
}

.btn-danger {
    background-color: #c0392b;
    color: var(--color-white);
}

.btn-danger:hover {
    background-color: #a93226;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    box-shadow: none;
}

.btn-compact {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.2;
    box-shadow: none;
    border-radius: 12px;
    font-weight: 600;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon .icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
}

.btn-icon .icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.button-container {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    font-family: var(--font-family);
    font-size: 1rem;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    resize: vertical;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(231, 140, 34, 0.2);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.hint {
    font-size: 0.85rem;
    color: var(--color-muted);
    display: block;
    margin-top: -0.7rem;
    margin-bottom: 1rem;
}

/* --- Index Page --- */
.index-page {
    text-align: left;
}

.index-page h2 {
    margin-bottom: 0;
}

.index-page p {
    margin-bottom: 0;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.results-lookup {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px dashed var(--color-muted);
    border-radius: 5px;
}

/* --- Wizard Form --- */
.wizard-form .wizard-step {
    display: none;
    border: none;
    padding: 0;
}

.wizard-form .wizard-step.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wizard-form legend {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-secondary);
    border-bottom: 2px solid rgba(231, 140, 34, 0.35);
    padding-bottom: 0.5rem;
    width: 100%;
}

.wizard-buttons {
    display: grid;
    align-items: center;
    gap: 1rem;
    margin-top: 2.5rem;
    grid-template-columns: 1fr auto auto;
    width: 100%;
}

.wizard-buttons #next-btn,
.wizard-buttons #submit-btn {
    justify-self: end;
}

.wizard-buttons #prev-btn {
    justify-self: start;
}

.step-indicator {
    margin-bottom: 1rem;
    color: var(--color-muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.step-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    align-items: stretch;
    align-content: start;
    grid-auto-rows: minmax(72px, auto);
    justify-items: stretch;
    grid-auto-flow: row;
}

.step-nav-item {
    background: #ffffff;
    border: 1px solid #e8e2d8;
    border-radius: 999px;
    padding: 0.65rem 1rem;
    text-align: left;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    min-height: 72px;
    height: 100%;
}

.step-nav-item:hover {
    transform: translateY(-1px);
    border-color: var(--color-primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.step-nav-item .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: #fbf7f0;
    border: 1px solid #e8e2d8;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.step-nav-item .step-title {
    font-size: 0.93rem;
    line-height: 1.25;
    font-weight: 600;
}

.step-nav-item.is-filled {
    border-color: rgba(22, 163, 74, 0.6);
    background: #f1fbf5;
}

.step-nav-item.is-not-filled {
    border-color: rgba(245, 158, 11, 0.7);
    background: #fff7e9;
}

.step-nav-item.is-new {
    border-color: #e5e7eb;
    background: #ffffff;
}

.step-nav-item.is-current {
    border-color: var(--color-primary);
    background: #fff4e1;
    box-shadow: 0 12px 24px rgba(231, 140, 34, 0.18);
    outline: 2px solid rgba(231, 140, 34, 0.18);
    outline-offset: 2px;
}

.step-nav-item.is-current .step-number {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.draft-link {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border: 1px dashed rgba(148, 163, 184, 0.8);
    border-radius: 18px;
    background: #fffbf6;
}

.draft-choice {
    margin-bottom: 1.5rem;
    padding: 1.3rem;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.draft-link-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin: 0.5rem 0 1rem 0;
    flex-wrap: wrap;
}

.draft-link-controls input {
    flex: 1 1 320px;
    min-width: 240px;
    max-width: 100%;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draft-link-controls .btn {
    flex-shrink: 0;
}

.draft-link-controls .btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.draft-link-controls .btn .icon {
    width: 16px;
    height: 16px;
}

.draft-link-controls input[type="text"] {
    margin-bottom: 0;
}

/* --- Results Page --- */
.results-page h2, .results-page h3 {
    text-align: center;
    margin-bottom: 1rem;
}

.result-link {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border: 1px dashed rgba(148, 163, 184, 0.8);
    border-radius: 18px;
    background: #fbfdff;
}

@media (max-width: 900px) {
    .step-nav {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .wizard-buttons {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .wizard-buttons #prev-btn,
    .wizard-buttons #next-btn,
    .wizard-buttons #submit-btn {
        justify-self: stretch;
    }
}

.recaptcha-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.recaptcha-status {
    font-size: 0.9rem;
    color: var(--color-muted);
}

.results-page h3 {
    font-weight: 500;
    color: var(--color-text);
}

.results-page p i {
    color: var(--color-muted);
    font-size: 0.9rem;
    display: block;
    text-align: center;
    margin-bottom: 2rem;
}

.result-item {
    margin-bottom: 1.5rem;
    padding: 1rem 1.1rem;
    background: #f8fafc;
    border-left: 4px solid var(--color-accent);
    border-radius: 16px;
}

.result-item h4 {
    margin-bottom: 0.5rem;
    color: var(--color-secondary);
}
.result-item p {
    white-space: pre-wrap; /* Preserve line breaks */
}

/* --- Admin Panel --- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tabs {
    border-bottom: 1px solid #ccc;
    margin-bottom: 1rem;
}

.tab-link {
    background-color: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 1rem;
}

.tab-link:hover {
    background-color: #ddd;
}

.tab-link.active {
    background-color: #ccc;
    border-bottom: 2px solid var(--color-primary);
}

.tab-content {
    display: none;
    padding: 1rem 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
}

table th, table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 0.8rem;
    text-align: left;
    vertical-align: middle;
}

table th {
    background-color: #f8fafc;
    color: var(--color-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.table-scroll {
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.table-scroll table {
    min-width: 760px;
    table-layout: auto;
}

#drafts-table th:nth-child(4),
#drafts-table td:nth-child(4),
#invites-table th:nth-child(4),
#invites-table td:nth-child(4) {
    width: 45%;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.table-actions .btn {
    white-space: nowrap;
}

.invite-link-input {
    min-width: 280px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.checkbox-label input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: checkbox;
    width: 1.15rem;
    height: 1.15rem;
    margin-bottom: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    background: none;
}
.checkbox-label label {
    cursor: pointer;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-white);
}

.status-new {
    background: var(--color-primary);
}

.status-opened {
    background: var(--color-accent);
}

.status-acknowledged {
    background: var(--color-success);
}

.status-started {
    background: var(--color-secondary);
}

.draft-link-input {
    padding: 0.45rem 0.6rem;
    font-size: 0.88rem;
    width: 100%;
    min-width: 260px;
    max-width: 100%;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Forms Filters & Sorting --- */
.forms-filters {
    margin-bottom: 1rem;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-row label {
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.filter-row select {
    width: auto;
    min-width: 140px;
    margin-bottom: 0;
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
    border-radius: 0.6rem;
}

.forms-count {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-left: auto;
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    color: var(--color-primary);
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal-content {
    background-color: #fefefe;
    padding: 24px;
    border: none;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin: auto;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#modal-edit-form .form-field {
    margin-bottom: 1rem;
}

/* --- Notifications --- */
#notification-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.notification {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    color: var(--color-white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background-color: var(--color-success);
}

.notification.error {
    background-color: var(--color-error);
}

.notification.info {
    background-color: var(--color-accent);
}
