/**
 * JSON Form Editor Styles
 * Black and white theme matching CMS design
 */

/* Form Container */
.json-form-container {
    padding: 0;
}

/* Field Groups */
.field-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.field-group:last-child {
    border-bottom: none;
}

/* Field Keys (Read-only labels) */
.field-key {
    display: block;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 8px;
    cursor: help;
    font-family: 'Courier New', monospace;
}

.field-key::before {
    content: '🔒 ';
    font-size: 10px;
    opacity: 0.5;
}

/* Field Values (Editable inputs) */
.field-value {
    width: 100%;
    padding: 12px;
    border: 2px solid #000;
    background: #fff;
    color: #000;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.2s;
}

.field-value:focus {
    outline: none;
    border-color: #000;
    background: #f9f9f9;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.field-value:hover {
    background: #fafafa;
}

/* Textarea */
.field-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 2px solid #000;
    background: #fff;
}

.field-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin: 0;
}

.checkbox-label {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #000;
}

/* Nested Objects */
.nested-section {
    border: 2px solid #000;
    margin-bottom: 15px;
    background: #fff;
}

.nested-section.collapsed {
    background: #f5f5f5;
}

.nested-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #000;
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.nested-header:hover {
    background: #333;
}

.nested-toggle {
    font-size: 12px;
    transition: transform 0.2s;
}

.nested-title {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 13px;
    flex: 1;
}

.nested-badge {
    font-size: 11px;
    padding: 3px 8px;
    background: #fff;
    color: #000;
    border: 1px solid #fff;
    font-weight: normal;
}

.nested-content {
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #000;
}

/* Arrays */
.array-section {
    border: 2px solid #000;
    margin-bottom: 15px;
    background: #fff;
}

.array-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #000;
    color: #fff;
    border-bottom: 1px solid #000;
}

.array-header .field-key {
    color: #fff;
    margin: 0;
    flex: 1;
    cursor: default;
}

.array-header .field-key::before {
    content: '📋 ';
}

.array-badge {
    font-size: 11px;
    padding: 3px 8px;
    background: #fff;
    color: #000;
    border: 1px solid #fff;
    font-weight: bold;
}

.array-add-btn {
    padding: 6px 12px;
    background: #fff;
    color: #000;
    border: 2px solid #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.array-add-btn:hover {
    background: #000;
    color: #fff;
}

/* Array Items */
.array-items {
    padding: 15px;
    background: #fafafa;
}

.array-item {
    margin-bottom: 15px;
    border: 2px solid #000;
    background: #fff;
}

.array-item:last-child {
    margin-bottom: 0;
}

.array-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #000;
}

.array-item-label {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.array-remove-btn {
    padding: 4px 8px;
    background: #000;
    color: #fff;
    border: 2px solid #000;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.array-remove-btn:hover {
    background: #fff;
    color: #000;
}

.array-item-content {
    padding: 15px;
}

.array-item-content .field-group {
    margin-bottom: 12px;
    padding-bottom: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .field-value {
        font-size: 13px;
        padding: 10px;
    }

    .nested-content,
    .array-items {
        padding: 12px;
    }

    .array-item-content {
        padding: 12px;
    }
}

/* Empty State */
.json-form-empty {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
}

/* Loading State */
.json-form-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.json-form-loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

/* Type Indicators */
.field-key::after {
    content: attr(data-type);
    font-size: 9px;
    padding: 2px 4px;
    margin-left: 5px;
    background: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-weight: normal;
}

/* Accessibility */
.field-value:focus-visible {
    outline: 3px solid #000;
    outline-offset: 2px;
}

.nested-header:focus-visible,
.array-add-btn:focus-visible,
.array-remove-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -3px;
}

/* Print Styles */
@media print {

    .array-add-btn,
    .array-remove-btn {
        display: none;
    }

    .nested-toggle {
        display: none;
    }

    .nested-content {
        display: block !important;
    }
}