/* HTML Table Generator */

.htg-dropzone {
    border: 2px dashed #adb5bd;
    border-radius: 0.5rem;
    padding: 1.5rem 1rem;
    background: #fff;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.htg-dropzone.is-dragover {
    border-color: #0d6efd;
    background: #e7f1ff;
}

.htg-dropzone-icon {
    font-size: 2.4rem;
    line-height: 1;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

/* Editor */

.htg-editor-wrap {
    overflow: auto;
    max-height: 520px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
}

.htg-editor {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
    font-size: 0.9rem;
    margin: 0;
}

.htg-editor th,
.htg-editor td {
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
    vertical-align: top;
}

.htg-editor thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f3f5;
    color: #495057;
    font-weight: 600;
    text-align: center;
    padding: 0.25rem 0.4rem;
    white-space: nowrap;
}

.htg-editor .htg-corner,
.htg-editor .htg-rowhead {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #f1f3f5;
    color: #6c757d;
    font-weight: 500;
    text-align: right;
    padding: 0.3rem 0.4rem;
    white-space: nowrap;
    min-width: 3.4rem;
}

.htg-editor .htg-corner {
    z-index: 3;
}

.htg-editor td[contenteditable] {
    min-width: 120px;
    max-width: 320px;
    padding: 0.3rem 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    outline: none;
    cursor: text;
}

.htg-editor td[contenteditable]:focus {
    position: relative;
    z-index: 1;
    background: #fff;
    box-shadow: inset 0 0 0 2px #0d6efd;
}

.htg-editor tr.htg-header-row td {
    background: #fff8e1;
    font-weight: 600;
}

.htg-editor tr.htg-header-row .htg-rowhead {
    background: #ffecb5;
    color: #664d03;
}

.htg-editor td.htg-filler,
.htg-editor th.htg-addcol {
    border-right: 0;
    width: 2.2rem;
}

.htg-btn {
    border: 0;
    background: transparent;
    color: #6c757d;
    padding: 0 0.25rem;
    line-height: 1.3;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 0.2rem;
}

.htg-btn:hover:not(:disabled) {
    background: #dee2e6;
    color: #212529;
}

.htg-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.htg-btn-del {
    font-size: 1rem;
}

.htg-btn-del:hover:not(:disabled) {
    background: #f8d7da;
    color: #b02a37;
}

.htg-btn-add {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0d6efd;
}

.htg-colbtns {
    display: inline-flex;
    margin-left: 0.35rem;
}

.htg-rowhead .htg-btn-del {
    margin-left: 0.2rem;
}

/* Preview + output */

.htg-preview {
    overflow-x: auto;
    background: #fff;
}

.htg-output {
    min-height: 300px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
}
