.notebook-template-panel {
    margin-top: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.notebook-template-header {
    padding: 12px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notebook-template-header:hover {
    background: #eee;
}

.notebook-template-header .fa {
    color: #666;
    width: 16px;
}

.unsaved-indicator {
    color: #f0ad4e;
    font-weight: normal;
    font-size: 12px;
}

.notebook-template-content {
    padding: 20px;
}

.template-description {
    color: #666;
    margin-bottom: 12px;
    font-size: 14px;
}

.template-enabled-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    cursor: pointer;
}

.template-enabled-toggle input[type="checkbox"] {
    margin: 0;
}

.loading-indicator {
    text-align: center;
    padding: 30px;
    color: #666;
}

.fields-list {
    margin-bottom: 20px;
}

.field-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
    background: #fafafa;
}

.fields-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}

.fields-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 10px 0 20px;
}

.fields-pager .pager-info {
    font-size: 13px;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.fields-pager .pager-select {
    width: auto;
    display: inline-block;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 4px 4px 0 0;
}

/* A collapsed field has no body, so round the bottom of the header too. */
.field-collapsed .field-header {
    border-bottom: none;
    border-radius: 4px;
}

.field-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.field-toggle .field-chevron {
    color: #666;
    width: 12px;
    transition: transform 0.2s ease;
}

/* Chevron points right when the field is collapsed, down when open. */
.field-toggle .field-chevron.collapsed {
    transform: rotate(-90deg);
}

.field-preview {
    color: #888;
    font-size: 13px;
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.field-number {
    font-weight: bold;
    color: #666;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex: 0 0 auto;
}

.field-actions {
    display: flex;
    gap: 5px;
}

.field-actions .btn-link {
    padding: 2px 6px;
    color: #666;
}

.field-actions .btn-link:hover {
    color: #333;
}

.field-actions .btn-link.text-danger:hover {
    color: #d9534f;
}

/*
 * Slide the field body open/closed via a plain CSS transition (no ngAnimate).
 * The element stays in the DOM and we just toggle .field-config-collapsed; the
 * editor inside is built once (ng-if on opened[fieldId]) and then kept mounted.
 * max-height is an upper bound large enough for an editor + table/vocab config.
 */
.field-config {
    padding: 15px;
    max-height: 2000px;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}

.field-config.field-config-collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.field-config .form-group {
    margin-bottom: 12px;
}

.field-config label {
    font-weight: 500;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}

.table-config {
    margin-top: 10px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.columns-list {
    margin-bottom: 10px;
}

.column-item {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    align-items: center;
}

.column-item .form-control {
    flex: 1;
}

.template-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.template-actions .btn-primary {
    margin-left: auto;
}

/* Label editor (Froala) styles */
.field-config .label-editor {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

.field-config .label-editor .fr-box {
    border: none !important;
}

.field-config .label-editor .fr-toolbar {
    border: none !important;
    border-bottom: 1px solid #e0e0e0 !important;
    border-radius: 4px 4px 0 0 !important;
    background: #f8f8f8 !important;
}

.field-config .label-editor .fr-wrapper {
    border: none !important;
}

.field-config .label-editor .fr-element {
    padding: 10px 12px !important;
    min-height: 40px !important;
}

.field-config .label-editor .fr-second-toolbar {
    display: none !important;
}

/* Field type selector */
.field-type-select {
    flex: 1;
    margin: 0 15px;
}

.field-type-select select {
    min-width: 160px;
}

/* Table config improvements */
.table-config .config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.table-config .config-row:last-child {
    margin-bottom: 0;
}

.table-config .config-row label {
    white-space: nowrap;
    margin: 0;
    min-width: 150px;
}

.table-config .config-row .form-control {
    flex: 1;
}

/* Vocab configuration */
.vocab-config {
    margin-top: 10px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

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

.vocab-terms-header label {
    margin: 0;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.vocab-terms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vocab-term-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.vocab-term-item .form-control:first-child {
    flex: 0 0 200px;
    font-weight: 600;
}

.vocab-term-item .form-control:nth-child(2) {
    flex: 1;
}

.vocab-term-item .btn-link {
    padding: 2px 6px;
    flex-shrink: 0;
}

.vocab-help-text {
    color: #999;
    font-size: 13px;
    font-style: italic;
    margin: 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: center;
}
