* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f8f9fa;
    color: #343a40;
    line-height: 1.6;
    padding-bottom: 80px;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 30px;
    font-weight: 600;
}

h2 {
     color: #007bff; 
     margin-bottom: 15px;
     font-size: 1.4em;
     font-weight: 500;
     display: flex;
     align-items: center;
     gap: 8px; 
}

h3 {
    color: #495057;
    margin-bottom: 15px;
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: 500;
    border-bottom: 1px solid #e9ecef; 
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

hr.section-divider {
    border: 0;
    height: 1px;
    background-color: #dee2e6;
    margin: 30px 0;
}

.card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.card-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
}
.card-header h2 {
    margin-bottom: 0;
}

.card-body {
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px;
}

.form-group {
    margin-bottom: 0; 
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-text {
    font-size: 0.875em;
    color: #6c757d; 
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

.file-input-container {
    margin-bottom: 20px;
}
.file-input-container > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    padding: 5px;
    gap: 10px;
    transition: border-color 0.2s ease;
}
.file-input-wrapper:has(input[type="file"]:focus) { 
     border-color: #80bdff;
     box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}


.file-input-wrapper input[type="file"] {
    display: none; 
}

.file-input-label {
    flex-shrink: 0;   
    padding: 8px 10px;
    background-color: #e9ecef; 
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #495057;
    transition: background-color 0.2s ease;
    overflow: hidden; 
    white-space: nowrap;
}
.file-input-label:hover {
    background-color: #dee2e6;
}
.file-input-label i {
    color: #007bff;
}
.file-input-label .file-name {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.95em;
}

.file-input-wrapper .rename-input {
    flex-grow: 1; 
    min-width: 150px; 
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 0.9em;
    background-color: #fff;
}
.file-input-wrapper .rename-input:focus {
     border-color: #80bdff;
     outline: 0;
}


.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; 
}

.upload-status {
    font-size: 1.1em;
    width: 20px; 
    text-align: center;
    line-height: 1; 
}
.upload-status.success i { color: #28a745; }
.upload-status.error i { color: #dc3545; } 
.upload-status.loading i { color: #007bff; animation: spin 1s linear infinite; } 

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.helper-links {
    font-size: 0.9em;
    margin-top: 5px;
    color: #6c757d;
}
.helper-links a {
    margin: 0 3px;
}
.helper-links i {
    margin-right: 3px;
}

.btn {
    display: inline-block;
    font-weight: 500;
    color: #212529;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.5rem 1rem; 
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
}
.btn i {
    margin-right: 5px;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}
.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d; 
    border-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

 .btn-success {
    color: #fff;
    background-color: #28a745; 
    border-color: #28a745;
}
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545; 
    border-color: #dc3545;
}
.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-warning {
    color: #212529;
    background-color: #ffc107; 
    border-color: #ffc107;
}
.btn-warning:hover {
     background-color: #e0a800;
     border-color: #d39e00;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.25rem;
}

.btn-icon {
    background: none;
    border: none;
    color: #6c757d; 
    padding: 5px;
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}
.btn-icon:hover {
    background-color: #e9ecef;
    color: #0056b3;
}
.btn-remove-response i {
    color: #dc3545; 
}
.btn-remove-response:hover {
    background-color: #f8d7da; 
}
.btn-remove-response:hover i {
    color: #a51826; 
}


.btn-add {
    margin-top: 15px;
    display: block; 
    width: fit-content; 
    margin-left: 0; 
}

.btn-close { 
     background: none;
     border: none;
     font-size: 1.5rem;
     line-height: 1;
     color: #6c757d;
     opacity: 0.7;
     padding: 5px;
}
.btn-close:hover {
    opacity: 1;
    color: #000;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6); 
    z-index: 1400;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1401;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex; 
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none; 
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s; 
}
.modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}
.modal-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.table-container {
    max-height: 65vh;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

#table-content {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

#table-content th,
#table-content td {
    border: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: top;
}

#table-content td {
    padding: 8px 10px;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#table-content td:not(:first-child) {
    cursor: pointer;
}

#table-content th {
    background-color: #e9ecef;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
    text-align: left;
    vertical-align: middle;
}

.th-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    width: 100%;
    overflow: hidden;
}

.th-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
    margin-right: 5px;
}

#table-content th .remove-btn {
    cursor: pointer;
    font-size: 0.9em;
    color: #dc3545;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
    padding: 2px 4px;
    line-height: 1;
}
#table-content th:hover .remove-btn {
    opacity: 1;
}

#table-content tr:nth-child(even) {
    background-color: #f8f9fa;
}
#table-content tr:hover {
    background-color: #e2e6ea;
}

#table-content td:first-child,
#table-content th:first-child {
    text-align: center;
    vertical-align: middle;
    width: 45px;
    max-width: 45px;
    cursor: default;
    white-space: normal;
    overflow: visible;
    padding: 8px 5px !important;
}
#table-content td:first-child .btn-icon {
    color: #dc3545;
    width: auto;
    height: auto;
}
#table-content td:first-child .btn-icon:hover {
    color: #a51826;
    background-color: #f8d7da;
}

#table-content textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 40px;
    max-height: 150px;
    border: 1px solid #007bff;
    padding: 5px;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    display: block;
}
#table-content td.editing {
    background-color: #fff !important;
    overflow: visible;
    white-space: normal;
    cursor: text;
    max-width: none;
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #e9ecef;
    border-top: 1px solid #ced4da;
    padding: 10px 20px;
    text-align: center;
    font-size: 0.8em;
    color: #6c757d;
    z-index: 1200;
    line-height: 1.4;
}
footer p { margin: 0; }
footer strong { color: #495057; }
footer a { color: #0056b3; }

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #6c757d;
    color: white;
    font-size: 12px;
    cursor: help;
    margin-left: 5px;
    vertical-align: middle;
    user-select: none;
    transition: background-color 0.2s;
}
.help-icon:hover {
    background-color: #5a6268;
}
.help-icon i {
    margin-right: 0;
    font-size: 1em;
    line-height: 1;
}

.help-tooltip {
    position: absolute;
    background-color: #343a40;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    max-width: 250px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    z-index: 1500 !important;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}