/* Variables - Matching User Item Design */
.variables-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* =================== DATA VARIABLE MODAL STYLES =================== */

.dv-modal {
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.dv-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.dv-modal-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dv-modal-header h3 {
    color: #f1f5f9;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
}

.dv-modal-header p {
    color: #94a3b8;
    font-size: 0.8rem;
    margin: 0;
}

.dv-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.dv-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid #374151;
    background: rgba(17, 24, 39, 0.5);
}

/* Sections */
.dv-section {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid #334155;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.dv-section:last-child {
    margin-bottom: 0;
}

.dv-section-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: rgba(51, 65, 85, 0.3);
    border-bottom: 1px solid #334155;
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
}

.dv-section-header i {
    color: #6366f1;
    font-size: 0.9rem;
}

.dv-section-content {
    padding: 1rem;
}

/* Form Elements */
.dv-form-group {
    margin-bottom: 0.9rem;
}

.dv-form-group:last-child {
    margin-bottom: 0;
}

.dv-form-group label {
    display: block;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.dv-input,
.dv-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.85rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dv-input:focus,
.dv-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.dv-input::placeholder {
    color: #64748b;
}

.dv-input-small {
    max-width: 180px;
}

.dv-hint {
    display: block;
    color: #64748b;
    font-size: 0.72rem;
    margin-top: 0.35rem;
}

/* Checkbox Group */
.dv-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dv-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    color: #cbd5e1;
    font-size: 0.8rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dv-checkbox-item:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

.dv-checkbox-item input[type="checkbox"] {
    display: none;
}

.dv-checkbox-box {
    width: 16px;
    height: 16px;
    border: 2px solid #475569;
    border-radius: 4px;
    position: relative;
    transition: all 0.15s ease;
}

.dv-checkbox-item input[type="checkbox"]:checked + .dv-checkbox-box {
    background: #6366f1;
    border-color: #6366f1;
}

.dv-checkbox-item input[type="checkbox"]:checked + .dv-checkbox-box::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Schema Section */
.dv-section-schema .dv-section-header {
    justify-content: flex-start;
}

.dv-section-schema .dv-section-header span {
    flex: 1;
}

.dv-detect-btn {
    background: rgba(139, 92, 246, 0.15) !important;
    border-color: #8b5cf6 !important;
    color: #a78bfa !important;
    font-size: 0.72rem !important;
    padding: 0.3rem 0.6rem !important;
}

.dv-detect-btn:hover {
    background: rgba(139, 92, 246, 0.25) !important;
}

.dv-schema-fields-wrapper {
    margin-top: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
}

.dv-schema-fields-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: rgba(51, 65, 85, 0.4);
    border-bottom: 1px solid #334155;
    font-size: 0.78rem;
    font-weight: 500;
    color: #94a3b8;
}

.dv-add-field-btn {
    background: transparent !important;
    border: 1px dashed #475569 !important;
    color: #6366f1 !important;
    font-size: 0.72rem !important;
    padding: 0.25rem 0.5rem !important;
}

.dv-add-field-btn:hover {
    border-color: #6366f1 !important;
    background: rgba(99, 102, 241, 0.1) !important;
}

.dv-schema-fields-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Schema Field Row */
.dv-field-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid #334155;
    border-radius: 6px;
    margin-bottom: 0.4rem;
    transition: border-color 0.15s ease;
}

.dv-field-row:last-child {
    margin-bottom: 0;
}

.dv-field-row:hover {
    border-color: #475569;
}

.dv-field-type-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 5px;
    color: #818cf8;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.dv-field-type-icon.type-string { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.dv-field-type-icon.type-number { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.dv-field-type-icon.type-boolean { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.dv-field-type-icon.type-date { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.dv-field-type-icon.type-url { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.dv-field-type-icon.type-textarea { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.dv-field-type-icon.type-object { background: rgba(249, 115, 22, 0.15); color: #fb923c; }

.dv-field-name-input {
    flex: 1;
    min-width: 80px;
    padding: 0.4rem 0.5rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #f1f5f9;
    font-size: 0.8rem;
}

.dv-field-name-input:focus {
    outline: none;
    border-color: #6366f1;
}

.dv-field-type-select {
    width: 100px;
    padding: 0.4rem 0.5rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #f1f5f9;
    font-size: 0.75rem;
}

.dv-field-type-select:focus {
    outline: none;
    border-color: #6366f1;
}

.dv-field-required {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.7rem;
    transition: all 0.15s ease;
}

.dv-field-required:hover {
    background: rgba(239, 68, 68, 0.15);
}

.dv-field-required.is-required {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.dv-field-required input {
    display: none;
}

.dv-field-delete {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dv-field-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Nested Fields */
.dv-nested-fields {
    margin-top: 0.5rem;
    margin-left: 1.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid #334155;
}

.dv-nested-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    padding: 0.3rem 0;
}

.dv-nested-label {
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dv-add-nested-btn {
    background: transparent !important;
    border: none !important;
    color: #6366f1 !important;
    font-size: 0.7rem !important;
    padding: 0.2rem 0.4rem !important;
    cursor: pointer;
}

.dv-add-nested-btn:hover {
    text-decoration: underline;
}

/* Empty State */
.dv-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #64748b;
    text-align: center;
}

.dv-empty-state i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.dv-empty-state p {
    font-size: 0.8rem;
    margin: 0 0 0.75rem 0;
}

@media (max-width: 600px) {
    .dv-modal {
        max-width: 95vw;
    }

    .dv-field-row {
        flex-wrap: wrap;
    }

    .dv-field-name-input {
        flex: 1 1 100%;
        order: 1;
    }

    .dv-field-type-icon {
        order: 0;
    }

    .dv-field-type-select {
        order: 2;
        flex: 1;
    }

    .dv-field-required {
        order: 3;
    }

    .dv-field-delete {
        order: 4;
    }
}

/* =================== ITEMS MANAGEMENT MODAL =================== */

.items-modal {
    max-width: 750px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.items-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.08) 100%);
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.items-modal-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.items-modal-title-wrap {
    flex: 1;
}

.items-modal-title-wrap h3 {
    color: #f1f5f9;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 0.15rem 0;
}

.items-modal-title-wrap p {
    color: #94a3b8;
    font-size: 0.8rem;
    margin: 0;
}

.items-add-btn {
    flex-shrink: 0;
}

/* Items Tools Bar */
.items-tools-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(30, 41, 59, 0.4);
    border-bottom: 1px solid #334155;
}

.items-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 280px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    transition: border-color 0.15s ease;
}

.items-search-wrap i {
    color: #64748b;
    font-size: 0.8rem;
}

.items-search-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f1f5f9;
    font-size: 0.85rem;
}

.items-search-wrap input::placeholder {
    color: #64748b;
}

.items-search-wrap:focus-within {
    border-color: #6366f1;
}

.items-tools-actions {
    display: flex;
    gap: 0.5rem;
}

.items-tools-actions .btn {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.6rem !important;
}

/* Import Drop Zone */
.import-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.4);
    border: 2px dashed #475569;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.import-drop-zone:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.import-drop-zone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.import-drop-zone i {
    font-size: 2rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.import-drop-zone p {
    color: #94a3b8;
    font-size: 0.85rem;
    margin: 0;
}

.items-stats-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.6rem 1.5rem;
    background: rgba(30, 41, 59, 0.6);
    border-bottom: 1px solid #334155;
}

.items-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.75rem;
}

.items-stat i {
    font-size: 0.7rem;
}

.items-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    min-height: 200px;
}

.items-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid #374151;
    background: rgba(17, 24, 39, 0.5);
}

/* Item Card Improved */
.item-card-v2 {
    display: flex;
    align-items: stretch;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid #334155;
    border-radius: 8px;
    margin-bottom: 0.6rem;
    overflow: hidden;
    cursor: grab;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-card-v2:hover {
    border-color: #475569;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.item-card-v2:last-child {
    margin-bottom: 0;
}

.item-card-v2.dragging {
    opacity: 0.4;
    border-color: #6366f1;
}

.item-card-v2.drop-target {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.item-card-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    background: rgba(51, 65, 85, 0.4);
    color: #64748b;
    font-size: 0.8rem;
    flex-shrink: 0;
    border-right: 1px solid #334155;
}

.item-card-drag-handle:hover {
    color: #94a3b8;
    background: rgba(51, 65, 85, 0.6);
}

.item-card-index {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.item-card-content {
    flex: 1;
    padding: 0.75rem 1rem;
    min-width: 0;
}

.item-card-title {
    color: #f1f5f9;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-card-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.item-card-field {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 4px;
    font-size: 0.7rem;
    max-width: 180px;
}

.item-card-field-name {
    color: #64748b;
}

.item-card-field-value {
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.75rem;
    border-left: 1px solid #334155;
}

.item-card-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.item-card-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #818cf8;
}

.item-card-btn.delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Items Empty State */
.items-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.items-empty-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    color: #6366f1;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.items-empty-state h4 {
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
}

.items-empty-state p {
    color: #64748b;
    font-size: 0.85rem;
    margin: 0 0 1.25rem 0;
    max-width: 280px;
}

/* =================== ADD/EDIT ITEM FORM MODAL =================== */

.item-form-modal {
    max-width: 550px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.item-form-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(236, 72, 153, 0.08) 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.item-form-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.item-form-header h3 {
    color: #f1f5f9;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 0.15rem 0;
}

.item-form-header p {
    color: #94a3b8;
    font-size: 0.8rem;
    margin: 0;
}

.item-form-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

.item-form-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid #374151;
    background: rgba(17, 24, 39, 0.5);
}

/* Form Field Styling */
.item-form-field {
    margin-bottom: 1rem;
}

.item-form-field:last-child {
    margin-bottom: 0;
}

.item-form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.item-form-label-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.65rem;
}

.item-form-label-icon.type-string { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.item-form-label-icon.type-number { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.item-form-label-icon.type-boolean { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.item-form-label-icon.type-date { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.item-form-label-icon.type-url { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.item-form-label-icon.type-textarea { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.item-form-label-icon.type-object { background: rgba(249, 115, 22, 0.15); color: #fb923c; }

.item-form-label-text {
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
}

.item-form-label-required {
    color: #f87171;
    font-size: 0.7rem;
}

.item-form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.85rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-form-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.item-form-input::placeholder {
    color: #64748b;
}

.item-form-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
}

.item-form-checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.item-form-checkbox-wrap:hover {
    border-color: #6366f1;
}

.item-form-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #8b5cf6;
}

.item-form-checkbox-label {
    color: #cbd5e1;
    font-size: 0.85rem;
}

.item-form-nested {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid #334155;
    border-radius: 6px;
}

.item-form-nested-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #334155;
}

@media (max-width: 600px) {
    .items-modal,
    .item-form-modal {
        max-width: 95vw;
    }

    .items-modal-header {
        flex-wrap: wrap;
    }

    .items-add-btn {
        width: 100%;
        margin-top: 0.75rem;
    }

    .item-card-field {
        max-width: 140px;
    }
}

.variable-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    background: linear-gradient(145deg, rgba(24, 32, 49, 0.96) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-radius: 8px;
    border: 1px solid rgba(129, 140, 248, 0.24);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.28);
    margin-bottom: 0.5rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.variable-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(59, 130, 246, 0.1));
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

.variable-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(15, 23, 42, 0.35);
    border-color: rgba(129, 140, 248, 0.48);
}

.variable-card:hover::before {
    opacity: 1;
}

.variable-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.variable-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.variable-identity {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.variable-name {
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    margin: 0;
}

.variable-value-preview {
    color: #cbd5f5;
    font-size: 0.78rem;
    word-break: break-word;
    font-family: 'Courier New', monospace;
}

.variable-badges {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.variable-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #ede9fe;
    background: rgba(139, 92, 246, 0.22);
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.variable-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

@media (max-width: 768px) {
    .variable-card {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100%;
    }

    .variable-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .variable-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    /* Data variable modals - mobile */
    .dv-modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 95vh !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
    }

    .dv-modal-header {
        padding: 0.875rem 1rem !important;
        gap: 0.75rem !important;
    }

    .dv-modal-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }

    .dv-modal-header h3 {
        font-size: 1rem !important;
    }

    .dv-modal-header p {
        font-size: 0.75rem !important;
    }

    .dv-modal-body {
        padding: 0.875rem !important;
    }

    .dv-modal-footer {
        padding: 0.75rem 1rem !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .dv-modal-footer .btn {
        flex: 1 1 calc(50% - 0.25rem) !important;
        min-width: 0 !important;
        justify-content: center !important;
        font-size: 0.85rem !important;
    }

    /* Sections */
    .dv-section {
        margin-bottom: 0.75rem !important;
    }

    .dv-section-header {
        padding: 0.6rem 0.875rem !important;
        font-size: 0.8rem !important;
    }

    .dv-section-content {
        padding: 0.75rem !important;
    }

    /* Form groups in modal */
    .dv-form-group {
        margin-bottom: 0.75rem !important;
    }

    .dv-form-group label {
        font-size: 0.8rem !important;
    }

    .dv-form-group input,
    .dv-form-group select,
    .dv-form-group textarea {
        font-size: 16px !important;
        padding: 0.625rem !important;
    }

    /* Field rows */
    .dv-field-row {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .dv-field-name-input {
        width: 100% !important;
    }

    .dv-field-type-select {
        width: 100% !important;
    }

    .dv-field-actions {
        align-self: flex-end !important;
    }

    /* Items modal - full screen on mobile */
    .items-modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 100vh !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .items-modal-header {
        padding: 0.75rem 1rem !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
    }

    .items-modal-icon {
        width: 32px !important;
        height: 32px !important;
    }

    .items-modal-title {
        font-size: 0.95rem !important;
    }

    .items-add-btn {
        width: 100% !important;
        order: 10 !important;
        margin-top: 0.5rem !important;
    }

    /* Tools bar */
    .items-tools-bar {
        flex-direction: column !important;
        gap: 0.5rem !important;
        padding: 0.75rem 1rem !important;
    }

    .items-search-wrap {
        width: 100% !important;
        max-width: 100% !important;
    }

    .items-tools-actions {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .items-tools-actions .btn {
        flex: 1 !important;
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
    }

    /* Items list */
    .items-modal-body {
        padding: 0.5rem !important;
    }

    .items-list {
        gap: 0.5rem !important;
    }

    /* Item cards v2 */
    .item-card-v2 {
        flex-direction: column !important;
        padding: 0 !important;
    }

    .item-card-drag-handle {
        display: none !important;
    }

    .item-card-content {
        width: 100% !important;
        padding: 0.75rem !important;
        border-right: none !important;
        border-bottom: 1px solid #334155 !important;
    }

    .item-card-index {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
        width: 22px !important;
        height: 22px !important;
        font-size: 0.6rem !important;
    }

    .item-preview-field {
        font-size: 0.8rem !important;
    }

    .item-preview-label {
        font-size: 0.7rem !important;
    }

    .item-preview-value {
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
    }

    .item-card-actions {
        width: 100% !important;
        justify-content: flex-end !important;
        padding: 0.5rem 0.75rem !important;
        gap: 0.375rem !important;
        border-left: none !important;
    }

    .item-card-btn {
        width: 38px !important;
        height: 38px !important;
    }

    /* Item form modal */
    .item-form-modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 100vh !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .item-form-header {
        padding: 0.75rem 1rem !important;
    }

    .item-form-container {
        padding: 0.875rem !important;
        overflow-y: auto !important;
    }

    .item-form-footer {
        padding: 0.75rem 1rem !important;
        gap: 0.5rem !important;
    }

    .item-form-footer .btn {
        flex: 1 !important;
        font-size: 0.85rem !important;
    }

    /* Import modal */
    .import-drop-zone {
        padding: 1.5rem !important;
    }

    .import-drop-zone i {
        font-size: 1.5rem !important;
    }

    .import-drop-zone p {
        font-size: 0.8rem !important;
        text-align: center !important;
    }
}

/* =================== DATA VARIABLE ITEMS ANIMATIONS =================== */

/* Item card base styles with animations */
.item-card {
    animation: itemFadeIn 0.2s ease-out forwards;
    opacity: 0;
}

@keyframes itemFadeIn {
    to {
        opacity: 1;
    }
}

/* Staggered animation for multiple items */
.item-card:nth-child(1) { animation-delay: 0ms; }
.item-card:nth-child(2) { animation-delay: 30ms; }
.item-card:nth-child(3) { animation-delay: 60ms; }
.item-card:nth-child(4) { animation-delay: 90ms; }
.item-card:nth-child(5) { animation-delay: 120ms; }
.item-card:nth-child(6) { animation-delay: 150ms; }
.item-card:nth-child(7) { animation-delay: 180ms; }
.item-card:nth-child(8) { animation-delay: 210ms; }
.item-card:nth-child(9) { animation-delay: 240ms; }
.item-card:nth-child(10) { animation-delay: 270ms; }

/* Item card hover effect */
.item-card {
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-card:hover {
    background: rgba(45, 55, 72, 0.6) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Dragging state */
.item-card[draggable="true"] {
    cursor: grab;
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.item-card[draggable="true"]:active {
    cursor: grabbing;
}

.item-card.dragging {
    opacity: 0.4;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Drop target highlight */
.item-card.drop-target {
    border-color: #6366f1 !important;
    background: rgba(99, 102, 241, 0.1) !important;
}

/* Schema field animations */
.schema-field-row {
    animation: fieldFadeIn 0.15s ease-out forwards;
    opacity: 0;
}

@keyframes fieldFadeIn {
    to {
        opacity: 1;
    }
}

.schema-field-row {
    transition: background 0.15s ease, border-color 0.15s ease;
}

.schema-field-row:hover {
    border-color: rgba(99, 102, 241, 0.4) !important;
    background: rgba(45, 55, 72, 0.4) !important;
}

/* Button animations for item actions */
.item-card .btn {
    transition: opacity 0.15s ease, background 0.15s ease;
}

.item-card .btn:hover {
    opacity: 0.85;
}

.item-card .btn:active {
    opacity: 0.7;
}

/* Delete button hover */
.item-card .btn[style*="ef4444"]:hover {
    background: rgba(239, 68, 68, 0.12) !important;
}

/* Edit button hover */
.item-card .btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Form field focus */
#itemFormContainer input:focus,
#itemFormContainer textarea:focus,
#itemFormContainer select:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    outline: none;
}

/* Schema editor input focus */
#schemaFieldsList input:focus,
#schemaFieldsList select:focus {
    border-color: #6366f1 !important;
    outline: none;
}

/* Success highlight for saved items */
.item-card.just-saved {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    transition: background 0.4s ease, border-color 0.4s ease;
}

/* Reorder highlight */
.item-card.reordered {
    background: rgba(99, 102, 241, 0.1) !important;
    transition: background 0.3s ease;
}

/* Modal animation */
#dataVariableItemsModal .modal-content,
#addEditItemModal .modal-content {
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner */
.btn .loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Detect schema button */
#detectSchemaBtn {
    transition: background 0.15s ease, border-color 0.15s ease;
}

#detectSchemaBtn:hover {
    background: rgba(139, 92, 246, 0.15) !important;
    border-color: #8b5cf6 !important;
}

/* Add field button */
#schemaFieldsList + div .btn,
[onclick="addSchemaField()"] {
    transition: background 0.15s ease;
}

#schemaFieldsList + div .btn:hover,
[onclick="addSchemaField()"]:hover {
    background: rgba(99, 102, 241, 0.1) !important;
}
