/* Data Table Builder admin styles */

.kng-table-tabs .ka-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.ka-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.ka-alert-error {
    background: rgba(255, 59, 48, 0.12);
    color: #ff3b30;
}

.kng-table-editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.kng-table-editor-actions-left {
    flex: 1;
}

.kng-table-title-input {
    width: 100%;
    max-width: 420px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 16px;
    background: #fff;
}

.kng-table-editor-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kng-table-editor {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 260px;
    gap: 24px;
    align-items: start;
}

.kng-table-sidebar,
.kng-table-inspector {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kng-table-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kng-table-grid-wrap {
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: auto;
    background: #fff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
}

.kng-table-grid {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.kng-table-grid th,
.kng-table-grid td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 14px;
}

.kng-table-grid th {
    background: rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

.kng-table-grid td[contenteditable="true"] {
    background: #fff;
    cursor: text;
}

.kng-table-grid td.kng-selected,
.kng-table-grid th.kng-selected {
    outline: 2px solid #7c3aed;
    outline-offset: -2px;
}

.kng-column-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kng-column-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.kng-column-item input,
.kng-column-item select {
    width: 100%;
}

.kng-column-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6e6e73;
}

.kng-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.kng-table-import {
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 16px;
    background: #fff;
}

.kng-table-import-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.kng-table-import-text {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 12px;
    font-family: monospace;
}

.kng-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.kng-template-card {
    background: #fff;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.kng-template-preview {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(236, 72, 153, 0.08));
    border-radius: 14px;
    padding: 16px;
    display: grid;
    gap: 8px;
}

.kng-template-line {
    height: 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.15);
}

.kng-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kng-table-actions a {
    color: #7c3aed;
    text-decoration: none;
    font-size: 13px;
}

.kng-table-actions a:hover {
    text-decoration: underline;
}

body.ka-v3-dark .kng-table-title-input,
body.ka-v3-dark .kng-table-grid td[contenteditable="true"],
body.ka-v3-dark .kng-table-grid-wrap,
body.ka-v3-dark .kng-table-import,
body.ka-v3-dark .kng-template-card,
body.ka-v3-dark .kng-table-import-text {
    background: #0f0f12;
    border-color: rgba(255, 255, 255, 0.08);
    color: #f5f5f7;
}

body.ka-v3-dark .kng-table-grid th {
    background: rgba(255, 255, 255, 0.08);
}

body.ka-v3-dark .kng-table-grid th,
body.ka-v3-dark .kng-table-grid td {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.ka-v3-dark .kng-column-item label,
body.ka-v3-dark .kng-template-line {
    color: #a1a1a6;
    background: rgba(255, 255, 255, 0.2);
}

body.ka-v3-dark .ka-alert {
    background: rgba(124, 58, 237, 0.2);
    color: #c4b5fd;
}

body.ka-v3-dark .ka-alert-error {
    background: rgba(255, 69, 58, 0.2);
    color: #ff453a;
}

@media (max-width: 1200px) {
    .kng-table-editor {
        grid-template-columns: 1fr;
    }
}
